Corrected bug in AtdfService
This commit is contained in:
@@ -268,6 +268,20 @@ class AtdfService
|
|||||||
return $elements;
|
return $elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getImmediateChildElements(DOMElement $element, string $name): array
|
||||||
|
{
|
||||||
|
$output = [];
|
||||||
|
foreach ($element->childNodes as $childNode) {
|
||||||
|
if (!$childNode instanceof DOMElement || $childNode->nodeName !== $name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output[] = $childNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
private function getDeviceElementsFromXPath(string $expression, DOMDocument $document): DOMNodeList
|
private function getDeviceElementsFromXPath(string $expression, DOMDocument $document): DOMNodeList
|
||||||
{
|
{
|
||||||
return $this->getElementsFromXPath('devices/device[1]/' . $expression, $document);
|
return $this->getElementsFromXPath('devices/device[1]/' . $expression, $document);
|
||||||
@@ -787,8 +801,8 @@ class AtdfService
|
|||||||
{
|
{
|
||||||
$attributes = $this->getNodeAttributesByName($element);
|
$attributes = $this->getNodeAttributesByName($element);
|
||||||
|
|
||||||
$modeElements = $element->getElementsByTagName('mode');
|
$modeElements = $this->getImmediateChildElements($element, 'mode');
|
||||||
if ($modeElements->count() > 0) {
|
if (!empty($modeElements)) {
|
||||||
$parentGroup = new RegisterGroup(
|
$parentGroup = new RegisterGroup(
|
||||||
isset($attributes['name']) ? strtolower($attributes['name']) : null,
|
isset($attributes['name']) ? strtolower($attributes['name']) : null,
|
||||||
$attributes['name'] ?? null,
|
$attributes['name'] ?? null,
|
||||||
|
|||||||
Reference in New Issue
Block a user