Skip to content

Commit

Permalink
remove unneeded else
Browse files Browse the repository at this point in the history
  • Loading branch information
cancan101 committed Nov 25, 2024
1 parent c2dbc25 commit 9084fcf
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/DataObject/GridColumnConfig/Operator/VersionGetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,38 @@ public function getLabeledValue(array|ElementInterface $element): ResultContaine

if (!$children) {
return $result;
} else {
$c = $children[0];
}

$valueArray = [];
$c = $children[0];

$latestVersion = $element->getLatestVersion(null, false);
if($latestVersion){
$element = $latestVersion->loadData();
}
$valueArray = [];

$childResult = $c->getLabeledValue($element);
$isArrayType = $childResult->isArrayType ?? null;
$childValues = $childResult->value;
if ($childValues && !$isArrayType) {
$childValues = [$childValues];
}
$latestVersion = $element->getLatestVersion(null, false);
if($latestVersion){
$element = $latestVersion->loadData();
}

if ($childValues) {
/** @var string $childValue */
foreach ($childValues as $childValue) {
$valueArray[] = $childValue;
}
}
$childResult = $c->getLabeledValue($element);
$isArrayType = $childResult->isArrayType ?? null;
$childValues = $childResult->value;
if ($childValues && !$isArrayType) {
$childValues = [$childValues];
}

$result->isArrayType = $isArrayType;
if ($isArrayType) {
$result->value = $valueArray;
} else {
$result->value = $valueArray[0] ?? null;
if ($childValues) {
/** @var string $childValue */
foreach ($childValues as $childValue) {
$valueArray[] = $childValue;
}
}

$result->isArrayType = $isArrayType;
if ($isArrayType) {
$result->value = $valueArray;
} else {
$result->value = $valueArray[0] ?? null;
}

return $result;
}
}

0 comments on commit 9084fcf

Please sign in to comment.