From bcba65cec344c4923ff5cd79b6a9a5e48a84c30f Mon Sep 17 00:00:00 2001 From: Rick Date: Wed, 12 Nov 2025 19:27:11 -0600 Subject: [PATCH] - Added `generate-amd64.sh` script which uses the composer loaded version of the `elidrissidev/openapi-merge:152` package to generate the `src/Api/*` classes. The included `generate.sh` script was not compatible with my AMD64 (WSL2-Ubuntu) setup. - Added `elidrissidev/openapi-merge:152` as a composer dev dependency (required by `generate-amd64.sh`). - Added `cebe/php-openapi:1.7.0` as a composer dev dependency to lock version at 1.7.0. This was required because `elidrissidev/openapi-merge` depends on "^1.7.0" which results in "1.8.0" being installed which is not compatible. - Updated the `src/Api/*` classes by running `generate-amd64.sh` which fixes all PHP 8.4 deprecated warnings for "Implicitly marking parameter as nullable is deprecated, the explicit nullable type must be used instead" being triggered by the included generated classes in the current release. --- README.md | 4 + composer.json | 4 +- generate-amd64.sh | 14 + ...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 | 14 +- src/Api/Runtime/Client/Client.php | 22 +- .../Normalizer/ReferenceNormalizer.php | 55 +- 853 files changed, 53079 insertions(+), 127638 deletions(-) create mode 100755 generate-amd64.sh diff --git a/README.md b/README.md index 4d3fd7a1..f27253a2 100644 --- a/README.md +++ b/README.md @@ -157,4 +157,8 @@ Note that the HTTP Client **must not** throw exceptions for 4xx and 5xx response The classes under the `ShipStream\Ups\Api` namespace are all generated using [janephp](https://jane.readthedocs.io/en/latest/index.html). +**ARM/Docker Setups:**\ Run the `generate.sh` script to regenerate the classes when needed. + +**AMD64 (WSL/Linux) Setups:**\ +Run the `generate-amd64.sh` script to regenerate the classes when needed. \ No newline at end of file diff --git a/composer.json b/composer.json index e0b770c1..9a9509dd 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,9 @@ "require-dev": { "jane-php/open-api-3": "^7.6", "nyholm/psr7": "^1.8", - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^9.6", + "elidrissidev/openapi-merge": "1.5.2", + "cebe/php-openapi": "1.7.0" }, "autoload": { "psr-4": { diff --git a/generate-amd64.sh b/generate-amd64.sh new file mode 100755 index 00000000..38a4e06a --- /dev/null +++ b/generate-amd64.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# This version of the generate.sh script should work on any x86/amd64 linux based systems. +# You must run `composer install` prior to executing this. +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" +# Merge the individual OpenAPI definitions into a single file +[[ -e openapi.yaml ]] && rm -f openapi.yaml +vendor/bin/openapi-merge \ + --resolve-references 0 \ + -o openapi.yaml \ + openapi/Base.yaml \ + openapi/*.yaml +# Generate API classes with Jane +php -d memory_limit=512M vendor/bin/jane-openapi generate -c .jane-openapi.php \ No newline at end of file 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..0584931e 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') && null !== $data->getAddressLine1()) { + $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') && null !== $data->getAddressLine2()) { + $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') && null !== $data->getAddressLine3()) { + $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') && null !== $data->getCity()) { + $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') && null !== $data->getPostalCode()) { + $dataArray['postalCode'] = $data->getPostalCode(); } + if ($data->isInitialized('stateProvince') && null !== $data->getStateProvince()) { + $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..15d01b53 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') && 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\CandidateAddressKeyFormat::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\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') && 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\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..8a04eafe 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') && null !== $data->getRefreshTokenExpiresIn()) { + $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') && null !== $data->getRefreshTokenStatus()) { + $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') && 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\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..488bc341 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') && 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\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..1e039b94 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') && 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\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..34a08426 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') && null !== $data->getWeight()) { + $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..3b52f8a7 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') && null !== $data->getNegotiatedRateCharges()) { + $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..133e81d9 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') && null !== $data->getPackage()) { + $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') && null !== $data->getWarnings()) { + $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..f2f036fb 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') && 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\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..7a823c82 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') && null !== $data->getNegotiatedRateCharges()) { + $dataArray['NegotiatedRateCharges'] = $this->normalizer->normalize($data->getNegotiatedRateCharges(), 'json', $context); + } + if ($data->isInitialized('fRSShipmentData') && null !== $data->getFRSShipmentData()) { + $dataArray['FRSShipmentData'] = $this->normalizer->normalize($data->getFRSShipmentData(), 'json', $context); + } + if ($data->isInitialized('ratingMethod') && null !== $data->getRatingMethod()) { + $dataArray['RatingMethod'] = $data->getRatingMethod(); + } + if ($data->isInitialized('billableWeightCalculationMethod') && null !== $data->getBillableWeightCalculationMethod()) { + $dataArray['BillableWeightCalculationMethod'] = $data->getBillableWeightCalculationMethod(); + } + $dataArray['BillingWeight'] = $this->normalizer->normalize($data->getBillingWeight(), 'json', $context); + if ($data->isInitialized('shipmentIdentificationNumber') && null !== $data->getShipmentIdentificationNumber()) { + $dataArray['ShipmentIdentificationNumber'] = $data->getShipmentIdentificationNumber(); + } + if ($data->isInitialized('mIDualReturnShipmentKey') && null !== $data->getMIDualReturnShipmentKey()) { + $dataArray['MIDualReturnShipmentKey'] = $data->getMIDualReturnShipmentKey(); + } + if ($data->isInitialized('barCodeImage') && null !== $data->getBarCodeImage()) { + $dataArray['BarCodeImage'] = $data->getBarCodeImage(); + } + if ($data->isInitialized('packageResults') && null !== $data->getPackageResults()) { + $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') && null !== $data->getControlLogReceipt()) { + $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') && null !== $data->getForm()) { + $dataArray['Form'] = $this->normalizer->normalize($data->getForm(), 'json', $context); + } + if ($data->isInitialized('cODTurnInPage') && null !== $data->getCODTurnInPage()) { + $dataArray['CODTurnInPage'] = $this->normalizer->normalize($data->getCODTurnInPage(), 'json', $context); + } + if ($data->isInitialized('highValueReport') && null !== $data->getHighValueReport()) { + $dataArray['HighValueReport'] = $this->normalizer->normalize($data->getHighValueReport(), 'json', $context); + } + if ($data->isInitialized('labelURL') && null !== $data->getLabelURL()) { + $dataArray['LabelURL'] = $data->getLabelURL(); + } + if ($data->isInitialized('localLanguageLabelURL') && null !== $data->getLocalLanguageLabelURL()) { + $dataArray['LocalLanguageLabelURL'] = $data->getLocalLanguageLabelURL(); + } + if ($data->isInitialized('receiptURL') && null !== $data->getReceiptURL()) { + $dataArray['ReceiptURL'] = $data->getReceiptURL(); + } + if ($data->isInitialized('localLanguageReceiptURL') && null !== $data->getLocalLanguageReceiptURL()) { + $dataArray['LocalLanguageReceiptURL'] = $data->getLocalLanguageReceiptURL(); + } + if ($data->isInitialized('dGPaperImage') && null !== $data->getDGPaperImage()) { + $values_3 = []; + foreach ($data->getDGPaperImage() as $value_3) { + $values_3[] = $value_3; } - return $data; + $dataArray['DGPaperImage'] = $values_3; + } + if ($data->isInitialized('masterCartonID') && null !== $data->getMasterCartonID()) { + $dataArray['MasterCartonID'] = $data->getMasterCartonID(); + } + if ($data->isInitialized('roarRatedIndicator') && null !== $data->getRoarRatedIndicator()) { + $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..2052c65e 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') && null !== $data->getShippingLabel()) { + $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') && null !== $data->getForm()) { + $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..c9d16cc1 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') && null !== $data->getOpenHours()) { + $values = []; + foreach ($data->getOpenHours() as $value) { + $values[] = $value; + } + $dataArray['OpenHours'] = $values; + } + if ($data->isInitialized('closeHours') && null !== $data->getCloseHours()) { + $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..ef791225 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') && 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('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') && null !== $data->getDescription()) { + $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..80b2155c 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') && 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\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..3734760f 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') && null !== $data->getAddressClassification()) { + $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..484f0276 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') && null !== $data->getValidAddressIndicator()) { + $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') && null !== $data->getAmbiguousAddressIndicator()) { + $dataArray['AmbiguousAddressIndicator'] = $data->getAmbiguousAddressIndicator(); + } + if ($data->isInitialized('noCandidatesIndicator') && null !== $data->getNoCandidatesIndicator()) { + $dataArray['NoCandidatesIndicator'] = $data->getNoCandidatesIndicator(); + } + if ($data->isInitialized('addressClassification') && null !== $data->getAddressClassification()) { + $dataArray['AddressClassification'] = $this->normalizer->normalize($data->getAddressClassification(), 'json', $context); + } + if ($data->isInitialized('candidate') && null !== $data->getCandidate()) { + $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..d059f009 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,10 @@ 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); + return http_build_query($optionsResolved, '', '&', \PHP_QUERY_RFC3986); } public function getHeaders(array $baseHeaders = []): array { 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..dd0f9503 100644 --- a/src/Api/Runtime/Normalizer/ReferenceNormalizer.php +++ b/src/Api/Runtime/Normalizer/ReferenceNormalizer.php @@ -3,46 +3,27 @@ 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 +{ + /** + * {@inheritdoc} + */ + 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 + /** + * {@inheritdoc} + */ + 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