Same name in other branches
- 5.0.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::parseSoapResponse()
- 8.x-2.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::parseSoapResponse()
- 8.x-3.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::parseSoapResponse()
- 8.x-4.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::parseSoapResponse()
1 call to CssW3Form::parseSoapResponse()
- CssW3Form::testW3C dans advagg_validator/
src/ Form/ CssW3Form.php - Given a CSS file, test to make sure it is valid CSS.
Fichier
-
advagg_validator/
src/ Form/ CssW3Form.php, line 236
Classe
- CssW3Form
- Configure form for W3C validation of CSS files.
Namespace
Drupal\advagg_validator\FormCode
private function parseSoapResponse($xml) {
$doc = new DOMDocument();
$response = [];
// Try to load soap 1.2 XML response, and suppress warning reports if any.
if (!@$doc->loadXML($xml)) {
// Could not load the XML document.
return $response;
}
// Get the standard CDATA elements.
$cdata = [
'uri',
'checkedby',
'csslevel',
'date',
];
foreach ($cdata as $var) {
$element = $doc->getElementsByTagName($var);
if ($element->length) {
$response[$var] = $element->item(0)->nodeValue;
}
}
// Handle the element validity and get errors if not valid.
$element = $doc->getElementsByTagName('validity');
if ($element->length && $element->item(0)->nodeValue === 'true') {
$response['validity'] = TRUE;
}
else {
$response['validity'] = FALSE;
$errors = $doc->getElementsByTagName('error');
foreach ($errors as $error) {
$response['errors'][] = $this->domExtractor($error);
}
}
// Get warnings.
$warnings = $doc->getElementsByTagName('warning');
foreach ($warnings as $warning) {
$response['warnings'][] = $this->domExtractor($warning);
}
// Return response array.
return $response;
}