in src/OSS/Result/Result.php [144:173]
private function retrieveErrorCode($body)
{
if (empty($body) || false === strpos($body, '<?xml')) {
return '';
}
$flag = false;
try {
$xml = simplexml_load_string($body);
if (isset($xml->Code)) {
return strval($xml->Code);
}
$flag = true;
} catch (\Exception $e) {
$flag = true;
}
if ($flag === true) {
$start = strpos($body, '<Code>');
if ($start === false) {
return '';
}
$start += 6;
$end = strpos($body, '</Code>', $start);
if ($end === false) {
return '';
}
return substr($body, $start, $end - $start);
}
return '';
}