Replaced group attribute with name attribute in Signal TDF element
This commit is contained in:
@@ -770,6 +770,10 @@ class ValidationService
|
||||
{
|
||||
$failures = [];
|
||||
|
||||
if (empty($signal->name)) {
|
||||
$failures[] = 'Missing name';
|
||||
}
|
||||
|
||||
if (empty($signal->padKey)) {
|
||||
$failures[] = 'Missing pad key';
|
||||
|
||||
|
||||
@@ -371,10 +371,10 @@ class FromXmlService
|
||||
$attributes = $this->getNodeAttributesByName($element);
|
||||
|
||||
return new Signal(
|
||||
$attributes['name'] ?? null,
|
||||
$attributes['pad-key'] ?? null,
|
||||
$this->stringService->tryStringToInt($attributes['index'] ?? null),
|
||||
$attributes['function'] ?? null,
|
||||
$attributes['group'] ?? null,
|
||||
$attributes['field'] ?? null
|
||||
);
|
||||
}
|
||||
|
||||
@@ -186,6 +186,7 @@ class ToXmlService
|
||||
public function signalToXml(Signal $signal, DOMDocument $document): DOMElement
|
||||
{
|
||||
$element = $document->createElement('signal');
|
||||
$element->setAttribute('name', $signal->name);
|
||||
$element->setAttribute('pad-key', $signal->padKey);
|
||||
|
||||
if ($signal->index !== null) {
|
||||
@@ -196,10 +197,6 @@ class ToXmlService
|
||||
$element->setAttribute('function', $signal->function);
|
||||
}
|
||||
|
||||
if ($signal->group !== null) {
|
||||
$element->setAttribute('group', $signal->group);
|
||||
}
|
||||
|
||||
if ($signal->field !== null) {
|
||||
$element->setAttribute('field', $signal->field);
|
||||
}
|
||||
|
||||
@@ -3,23 +3,23 @@ namespace Targets\TargetDescriptionFiles;
|
||||
|
||||
class Signal
|
||||
{
|
||||
public ?string $name = null;
|
||||
public ?string $padKey = null;
|
||||
public ?int $index = null;
|
||||
public ?string $function = null;
|
||||
public ?string $group = null;
|
||||
public ?string $field = null;
|
||||
|
||||
public function __construct(
|
||||
?string $name,
|
||||
?string $padKey,
|
||||
?int $index,
|
||||
?string $function,
|
||||
?string $group,
|
||||
?string $field
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->padKey = $padKey;
|
||||
$this->index = $index;
|
||||
$this->function = $function;
|
||||
$this->group = $group;
|
||||
$this->field = $field;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user