You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
968 B
PHP
41 lines
968 B
PHP
<?php
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class SageParsersXml implements SageParserInterface
|
|
{
|
|
public function replacesAllOtherParsers()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function parse(&$variable, $varData)
|
|
{
|
|
return false; // this is an unsolved problem at humanity level
|
|
if (! SageHelper::isRichMode()) {
|
|
return false;
|
|
}
|
|
|
|
if (is_string($variable) && substr($variable, 0, 5) === '<?xml') {
|
|
try {
|
|
$e = libxml_use_internal_errors(true);
|
|
$xml = simplexml_load_string($variable);
|
|
libxml_use_internal_errors($e);
|
|
} catch (Exception $e) {
|
|
return false;
|
|
}
|
|
|
|
if (empty($xml)) {
|
|
return false;
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
|
|
// dd($xml);
|
|
|
|
$varData->addTabToView($variable, 'XML', SageParser::alternativesParse($variable, $xml));
|
|
}
|
|
}
|