Skip to content

Commit

Permalink
zrusena funkcia isValidXmlString()
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Lokšík committed Feb 27, 2017
1 parent 4cbb781 commit 1d7b6d6
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions src/SmartEmailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ protected function callSmartemailingApiWithCurl($data) {
return $this->getErrorXml($e->getCode(), $e->getMessage());
}

$xml = simplexml_load_string($response);

if ($this->isValidXmlString($response)) {
return new \SimpleXMLElement($response);

if ($xml) {
return $xml;
} else {
return $this->getErrorXml('500', 'Unknown Smartemailing API error.');
}
Expand All @@ -319,25 +319,4 @@ public function getErrorXml($code, $message) {
return $xml;
}


/**
* check if xml string is valid
*
* @param string $xmlString
* @return bool
*/
protected function isValidXmlString($xmlString) {
libxml_use_internal_errors(TRUE);

$doc = simplexml_load_string($xmlString);

if (!$doc) {
$errors = libxml_get_errors();

return empty($errors);
}

return FALSE;
}

}

0 comments on commit 1d7b6d6

Please sign in to comment.