@@ -795,7 +795,7 @@ private function mapCurrencyCode($code)
795
795
* @return Result
796
796
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
797
797
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
798
- * @SuppressWarnings(PHPMD.ElseExpression)
798
+ * @SuppressWarnings(PHPMD.ElseExpression)
799
799
*/
800
800
protected function _parseXmlResponse ($ xmlResponse )
801
801
{
@@ -820,37 +820,44 @@ protected function _parseXmlResponse($xmlResponse)
820
820
foreach ($ arr as $ shipElement ) {
821
821
$ code = (string )$ shipElement ->Service ->Code ;
822
822
if (in_array ($ code , $ allowedMethods )) {
823
- //The location of tax information is in a different place depending on whether we are using negotiated rates or not
823
+ //The location of tax information is in a different place
824
+ // depending on whether we are using negotiated rates or not
824
825
if ($ negotiatedActive ) {
825
- $ includeTaxesArr = $ xml ->getXpath ("//RatingServiceSelectionResponse/RatedShipment/NegotiatedRates/NetSummaryCharges/TotalChargesWithTaxes " );
826
- $ includeTaxesActive = $ this ->getConfigFlag (
827
- 'include_taxes '
828
- ) && !empty ($ includeTaxesArr );
826
+ $ includeTaxesArr = $ xml ->getXpath (
827
+ "//RatingServiceSelectionResponse/RatedShipment/NegotiatedRates "
828
+ . "/NetSummaryCharges/TotalChargesWithTaxes "
829
+ );
830
+ $ includeTaxesActive = $ this ->getConfigFlag ('include_taxes ' ) && !empty ($ includeTaxesArr );
829
831
if ($ includeTaxesActive ) {
830
- $ cost = $ shipElement ->NegotiatedRates ->NetSummaryCharges ->TotalChargesWithTaxes ->MonetaryValue ;
832
+ $ cost = $ shipElement ->NegotiatedRates
833
+ ->NetSummaryCharges
834
+ ->TotalChargesWithTaxes
835
+ ->MonetaryValue ;
836
+
831
837
$ responseCurrencyCode = $ this ->mapCurrencyCode (
832
- (string )$ shipElement ->NegotiatedRates ->NetSummaryCharges ->TotalChargesWithTaxes ->CurrencyCode
838
+ (string )$ shipElement ->NegotiatedRates
839
+ ->NetSummaryCharges
840
+ ->TotalChargesWithTaxes
841
+ ->CurrencyCode
833
842
);
834
- }
835
- else {
836
- $ cost = $ shipElement ->NegotiatedRates ->NetSummaryCharges ->GrandTotal ->MonetaryValue ;
843
+ } else {
844
+ $ cost = $ shipElement ->NegotiatedRates ->NetSummaryCharges ->GrandTotal ->MonetaryValue ;
837
845
$ responseCurrencyCode = $ this ->mapCurrencyCode (
838
846
(string )$ shipElement ->NegotiatedRates ->NetSummaryCharges ->GrandTotal ->CurrencyCode
839
847
);
840
848
}
841
849
} else {
842
- $ includeTaxesArr = $ xml ->getXpath (" //RatingServiceSelectionResponse/RatedShipment/TotalChargesWithTaxes " );
843
- $ includeTaxesActive = $ this -> getConfigFlag (
844
- ' include_taxes '
845
- ) && !empty ($ includeTaxesArr );
850
+ $ includeTaxesArr = $ xml ->getXpath (
851
+ " //RatingServiceSelectionResponse/RatedShipment/TotalChargesWithTaxes "
852
+ );
853
+ $ includeTaxesActive = $ this -> getConfigFlag ( ' include_taxes ' ) && !empty ($ includeTaxesArr );
846
854
if ($ includeTaxesActive ) {
847
855
$ cost = $ shipElement ->TotalChargesWithTaxes ->MonetaryValue ;
848
856
$ responseCurrencyCode = $ this ->mapCurrencyCode (
849
857
(string )$ shipElement ->TotalChargesWithTaxes ->CurrencyCode
850
858
);
851
- }
852
- else {
853
- $ cost = $ shipElement ->TotalCharges ->MonetaryValue ;
859
+ } else {
860
+ $ cost = $ shipElement ->TotalCharges ->MonetaryValue ;
854
861
$ responseCurrencyCode = $ this ->mapCurrencyCode (
855
862
(string )$ shipElement ->TotalCharges ->CurrencyCode
856
863
);
0 commit comments