![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-dhl/Model/Validator/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Dhl\Model\Validator; /** * Performs XML and string processing for errors produced by the DHL shipping service */ class ResponseErrorProcessor { /** * Processes error encountered in DHL XML response * * @param \SimpleXMLElement $xml * @param bool $isShippingLabel * @return \Magento\Framework\Phrase */ public function process($xml, $isShippingLabel) { $code = null; $data = null; $nodeCondition = isset($xml->Response->Status->Condition) ? $xml->Response->Status->Condition : $xml->GetQuoteResponse->Note->Condition; if ($isShippingLabel) { foreach ($nodeCondition as $condition) { $code = (string)$condition->ConditionCode; $data = (string)$condition->ConditionData; if (!empty($code) && !empty($data)) { break; } } return __('Error #%1 : %2', trim($code), trim($data)); } $code = (string)$nodeCondition->ConditionCode ?: 0; $data = (string)$nodeCondition->ConditionData ?: ''; return __('Error #%1 : %2', trim($code), trim($data)); } }