Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ResponseErrorProcessor.php
Go to the documentation of this file.
1 <?php
8 
13 {
21  public function process($xml, $isShippingLabel)
22  {
23  $code = null;
24  $data = null;
25  $nodeCondition = isset($xml->Response->Status->Condition)
26  ? $xml->Response->Status->Condition : $xml->GetQuoteResponse->Note->Condition;
27 
28  if ($isShippingLabel) {
29  foreach ($nodeCondition as $condition) {
30  $code = (string)$condition->ConditionCode;
31  $data = (string)$condition->ConditionData;
32  if (!empty($code) && !empty($data)) {
33  break;
34  }
35  }
36  return __('Error #%1 : %2', trim($code), trim($data));
37  }
38 
39  $code = (string)$nodeCondition->ConditionCode ?: 0;
40  $data = (string)$nodeCondition->ConditionData ?: '';
41  return __('Error #%1 : %2', trim($code), trim($data));
42  }
43 }
__()
Definition: __.php:13
$code
Definition: info.phtml:12