Typo correction
This commit is contained in:
@@ -30,10 +30,10 @@ class Module
|
||||
$keys = explode('.', $keys);
|
||||
}
|
||||
|
||||
$firstLevelSubGroupId = array_shift($keys);
|
||||
$firstLevelSubgroupKey = array_shift($keys);
|
||||
foreach ($this->registerGroups as $registerGroup) {
|
||||
if ($registerGroup->key === $firstLevelSubGroupId) {
|
||||
return !empty($keys) ? $registerGroup->getSubGroup($keys) : $registerGroup;
|
||||
if ($registerGroup->key === $firstLevelSubgroupKey) {
|
||||
return !empty($keys) ? $registerGroup->getSubgroup($keys) : $registerGroup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,16 +23,16 @@ class PropertyGroup
|
||||
$this->properties = $properties;
|
||||
}
|
||||
|
||||
public function getSubGroup(array|string $subGroupKeys): ?PropertyGroup
|
||||
public function getSubgroup(array|string $subgroupKeys): ?PropertyGroup
|
||||
{
|
||||
if (is_string($subGroupKeys)) {
|
||||
$subGroupKeys = explode('.', $subGroupKeys);
|
||||
if (is_string($subgroupKeys)) {
|
||||
$subgroupKeys = explode('.', $subgroupKeys);
|
||||
}
|
||||
|
||||
$firstLevelSubGroupKey = array_shift($subGroupKeys);
|
||||
foreach ($this->subPropertyGroups as $subGroup) {
|
||||
if ($subGroup->key === $firstLevelSubGroupKey) {
|
||||
return !empty($subGroupKeys) ? $subGroup->getSubGroup($subGroupKeys) : $subGroup;
|
||||
$firstLevelSubgroupKey = array_shift($subgroupKeys);
|
||||
foreach ($this->subPropertyGroups as $subgroup) {
|
||||
if ($subgroup->key === $firstLevelSubgroupKey) {
|
||||
return !empty($subgroupKeys) ? $subgroup->getSubgroup($subgroupKeys) : $subgroup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,25 +17,25 @@ class RegisterGroup
|
||||
public array $registers = [];
|
||||
|
||||
/** @var RegisterGroup[] */
|
||||
public array $subGroups = [];
|
||||
public array $subgroups = [];
|
||||
|
||||
/** @var RegisterGroupReference[] */
|
||||
public array $subGroupReferences = [];
|
||||
public array $subgroupReferences = [];
|
||||
|
||||
public function __construct(
|
||||
?string $key,
|
||||
?string $name,
|
||||
?int $offset,
|
||||
array $registers,
|
||||
array $subGroups,
|
||||
array $subGroupReferences
|
||||
array $subgroups,
|
||||
array $subgroupReferences
|
||||
) {
|
||||
$this->key = $key;
|
||||
$this->name = $name;
|
||||
$this->offset = $offset;
|
||||
$this->registers = $registers;
|
||||
$this->subGroups = $subGroups;
|
||||
$this->subGroupReferences = $subGroupReferences;
|
||||
$this->subgroups = $subgroups;
|
||||
$this->subgroupReferences = $subgroupReferences;
|
||||
}
|
||||
|
||||
public function getRegister(array|string $keys): ?Register
|
||||
@@ -45,7 +45,7 @@ class RegisterGroup
|
||||
}
|
||||
|
||||
$registerKey = array_pop($keys);
|
||||
$group = !empty($keys) > 1 ? $this->getSubGroup($keys) : $this;
|
||||
$group = !empty($keys) > 1 ? $this->getSubgroup($keys) : $this;
|
||||
|
||||
if ($group instanceof RegisterGroup) {
|
||||
foreach ($group->registers as $register) {
|
||||
@@ -58,16 +58,16 @@ class RegisterGroup
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getSubGroup(array|string $subGroupKeys): ?RegisterGroup
|
||||
public function getSubgroup(array|string $subgroupKeys): ?RegisterGroup
|
||||
{
|
||||
if (is_string($subGroupKeys)) {
|
||||
$subGroupKeys = explode('.', $subGroupKeys);
|
||||
if (is_string($subgroupKeys)) {
|
||||
$subgroupKeys = explode('.', $subgroupKeys);
|
||||
}
|
||||
|
||||
$firstLevelSubGroupKey = array_shift($subGroupKeys);
|
||||
foreach ($this->subGroups as $subGroup) {
|
||||
if ($subGroup->key === $firstLevelSubGroupKey) {
|
||||
return !empty($subGroupKeys) ? $subGroup->getSubGroup($subGroupKeys) : $subGroup;
|
||||
$firstLevelSubgroupKey = array_shift($subgroupKeys);
|
||||
foreach ($this->subgroups as $subgroup) {
|
||||
if ($subgroup->key === $firstLevelSubgroupKey) {
|
||||
return !empty($subgroupKeys) ? $subgroup->getSubgroup($subgroupKeys) : $subgroup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -460,30 +460,30 @@ class ValidationService
|
||||
$processedChildKeys[] = $register->key;
|
||||
}
|
||||
|
||||
foreach ($registerGroup->subGroups as $subGroup) {
|
||||
foreach ($registerGroup->subgroups as $subgroup) {
|
||||
$failures = array_merge(
|
||||
$failures,
|
||||
$this->validateRegisterGroup($subGroup, $moduleKey, $tdf)
|
||||
$this->validateRegisterGroup($subgroup, $moduleKey, $tdf)
|
||||
);
|
||||
|
||||
if ($subGroup->key !== null && in_array($subGroup->key, $processedChildKeys)) {
|
||||
$failures[] = 'Duplicate register sub group key ("' . $subGroup->key . '") detected';
|
||||
if ($subgroup->key !== null && in_array($subgroup->key, $processedChildKeys)) {
|
||||
$failures[] = 'Duplicate register sub group key ("' . $subgroup->key . '") detected';
|
||||
}
|
||||
|
||||
$processedChildKeys[] = $subGroup->key;
|
||||
$processedChildKeys[] = $subgroup->key;
|
||||
}
|
||||
|
||||
foreach ($registerGroup->subGroupReferences as $subGroupReference) {
|
||||
foreach ($registerGroup->subgroupReferences as $subgroupReference) {
|
||||
$failures = array_merge(
|
||||
$failures,
|
||||
$this->validateRegisterGroupReference($subGroupReference, $moduleKey, $tdf)
|
||||
$this->validateRegisterGroupReference($subgroupReference, $moduleKey, $tdf)
|
||||
);
|
||||
|
||||
if ($subGroupReference->key !== null && in_array($subGroupReference->key, $processedChildKeys)) {
|
||||
$failures[] = 'Duplicate register group reference key ("' . $subGroupReference->key . '") detected';
|
||||
if ($subgroupReference->key !== null && in_array($subgroupReference->key, $processedChildKeys)) {
|
||||
$failures[] = 'Duplicate register group reference key ("' . $subgroupReference->key . '") detected';
|
||||
}
|
||||
|
||||
$processedChildKeys[] = $subGroupReference->key;
|
||||
$processedChildKeys[] = $subgroupReference->key;
|
||||
}
|
||||
|
||||
return array_map(
|
||||
|
||||
@@ -241,12 +241,12 @@ class FromXmlService
|
||||
}
|
||||
|
||||
if ($childNode->nodeName === 'register-group') {
|
||||
$output->subGroups[] = $this->registerGroupFromElement($childNode);
|
||||
$output->subgroups[] = $this->registerGroupFromElement($childNode);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($childNode->nodeName === 'register-group-reference') {
|
||||
$output->subGroupReferences[] = $this->registerGroupReferenceFromElement($childNode);
|
||||
$output->subgroupReferences[] = $this->registerGroupReferenceFromElement($childNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,8 +208,8 @@ class ToXmlService
|
||||
|
||||
$children = array_merge(
|
||||
$registerGroup->registers,
|
||||
$registerGroup->subGroups,
|
||||
$registerGroup->subGroupReferences
|
||||
$registerGroup->subgroups,
|
||||
$registerGroup->subgroupReferences
|
||||
);
|
||||
|
||||
usort(
|
||||
|
||||
@@ -89,7 +89,7 @@ class TargetDescriptionFile
|
||||
$firstLevelGroupKey = array_shift($keys);
|
||||
foreach ($this->propertyGroups as $propertyGroup) {
|
||||
if ($propertyGroup->key === $firstLevelGroupKey) {
|
||||
return !empty($keys) ? $propertyGroup->getSubGroup($keys) : $propertyGroup;
|
||||
return !empty($keys) ? $propertyGroup->getSubgroup($keys) : $propertyGroup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,16 +280,16 @@ class TargetDescriptionFile
|
||||
$addressOffset += $registerGroup->offset ?? 0;
|
||||
$output = new TargetRegisterGroup($registerGroup->key, $registerGroup->name, $addressOffset, [], []);
|
||||
|
||||
foreach ($registerGroup->subGroups as $subGroup) {
|
||||
$output->subGroups[] = $this->targetRegisterGroupFromRegisterGroup($subGroup, $addressOffset, $moduleKey);
|
||||
foreach ($registerGroup->subgroups as $subgroup) {
|
||||
$output->subgroups[] = $this->targetRegisterGroupFromRegisterGroup($subgroup, $addressOffset, $moduleKey);
|
||||
}
|
||||
|
||||
foreach ($registerGroup->subGroupReferences as $subGroupReference) {
|
||||
$subGroup = $this->resolveRegisterGroupReference($subGroupReference, $moduleKey);
|
||||
foreach ($registerGroup->subgroupReferences as $subgroupReference) {
|
||||
$subgroup = $this->resolveRegisterGroupReference($subgroupReference, $moduleKey);
|
||||
|
||||
if ($subGroup instanceof RegisterGroup) {
|
||||
$output->subGroups[] = $this->targetRegisterGroupFromRegisterGroup(
|
||||
$subGroup,
|
||||
if ($subgroup instanceof RegisterGroup) {
|
||||
$output->subgroups[] = $this->targetRegisterGroupFromRegisterGroup(
|
||||
$subgroup,
|
||||
$addressOffset,
|
||||
$moduleKey
|
||||
);
|
||||
|
||||
@@ -36,11 +36,11 @@ class TargetPeripheral
|
||||
$keys = explode('.', $keys);
|
||||
}
|
||||
|
||||
$firstLevelSubGroupId = array_shift($keys);
|
||||
$firstLevelSubgroupId = array_shift($keys);
|
||||
|
||||
foreach ($this->registerGroups as $registerGroup) {
|
||||
if ($registerGroup->key === $firstLevelSubGroupId) {
|
||||
return !empty($keys) ? $registerGroup->getSubGroup($keys) : $registerGroup;
|
||||
if ($registerGroup->key === $firstLevelSubgroupId) {
|
||||
return !empty($keys) ? $registerGroup->getSubgroup($keys) : $registerGroup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,17 +23,17 @@ class TargetRegisterGroup
|
||||
public ?int $baseAddress = null;
|
||||
|
||||
/** @var TargetRegisterGroup[] */
|
||||
public array $subGroups = [];
|
||||
public array $subgroups = [];
|
||||
|
||||
/** @var TargetRegister[] */
|
||||
public array $registers = [];
|
||||
|
||||
public function __construct(?string $key, ?string $name, ?int $baseAddress, array $subGroups, array $registers)
|
||||
public function __construct(?string $key, ?string $name, ?int $baseAddress, array $subgroups, array $registers)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->name = $name;
|
||||
$this->baseAddress = $baseAddress;
|
||||
$this->subGroups = $subGroups;
|
||||
$this->subgroups = $subgroups;
|
||||
$this->registers = $registers;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class TargetRegisterGroup
|
||||
}
|
||||
|
||||
$registerKey = array_pop($keys);
|
||||
$group = !empty($keys) > 1 ? $this->getSubGroup($keys) : $this;
|
||||
$group = !empty($keys) > 1 ? $this->getSubgroup($keys) : $this;
|
||||
|
||||
if ($group instanceof TargetRegisterGroup) {
|
||||
foreach ($group->registers as $register) {
|
||||
@@ -57,16 +57,16 @@ class TargetRegisterGroup
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getSubGroup(array|string $subGroupKeys): ?TargetRegisterGroup
|
||||
public function getSubgroup(array|string $subgroupKeys): ?TargetRegisterGroup
|
||||
{
|
||||
if (is_string($subGroupKeys)) {
|
||||
$subGroupKeys = explode('.', $subGroupKeys);
|
||||
if (is_string($subgroupKeys)) {
|
||||
$subgroupKeys = explode('.', $subgroupKeys);
|
||||
}
|
||||
|
||||
$firstLevelSubGroupKey = array_shift($subGroupKeys);
|
||||
foreach ($this->subGroups as $subGroup) {
|
||||
if ($subGroup->key === $firstLevelSubGroupKey) {
|
||||
return !empty($subGroupKeys) ? $subGroup->getSubGroup($subGroupKeys) : $subGroup;
|
||||
$firstLevelSubgroupKey = array_shift($subgroupKeys);
|
||||
foreach ($this->subgroups as $subgroup) {
|
||||
if ($subgroup->key === $firstLevelSubgroupKey) {
|
||||
return !empty($subgroupKeys) ? $subgroup->getSubgroup($subgroupKeys) : $subgroup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user