/** * Reformats the error data in the response to a printable text or html output * * @param AbstractResponseType $response A response returned by any of the eBay API calls * @param Boolean $asHtml Flag to pass the error in htmlentities for better formating * @param Boolean $addSlashes Uses addslashes to make the error-string directly insertable to a DB * @return string */ public function getErrorsToString($response, $asHtml = false, $addSlashes = true) { $errmsg = ''; if (count($response->getErrors())) { foreach ($response->getErrors() as $errorEle) { $errmsg .= '#' . $errorEle->getErrorCode() . ' : ' . ($asHtml ? htmlentities($errorEle->getLongMessage()) : $errorEle->getLongMessage()) . ($asHtml ? "<br>" : "\r\n"); } } if ($addSlashes) { return addslashes($errmsg); } else { return $errmsg; } }