Skip to content

Commit 344770e

Browse files
committed
Refactor getFullKey method: simplify logic for handling context and key concatenation.
1 parent 3db77e9 commit 344770e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Support/Exposer/Builder.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,13 @@ public function setProtected(bool $protected): void
131131
public function getFullKey(): ?string
132132
{
133133
$key = $this->getKey();
134-
$keyContext = $this->getContextKey();
135-
return $keyContext . (empty($key) ? null : (empty($keyContext) ? $key : '.' . $key));
134+
$context = $this->getContextKey();
135+
136+
if ($key === null || $key === '') {
137+
return $context ?: null;
138+
}
139+
140+
return $context ? "{$context}.{$key}" : $key;
136141
}
137142

138143
/**

0 commit comments

Comments
 (0)