Skip to content

Commit 845aa3c

Browse files
committed
Fixed issue depth greater than 1
- it returned allways first level
1 parent 8632da7 commit 845aa3c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Response/Result/Hit.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,22 @@ public function getFloatOrNullValue(string $key): float|null
159159

160160
public function getSubValue(string $key): mixed
161161
{
162-
if (\str_contains($key, \Spameri\ElasticQuery\Mapping\Settings\Mapping\FieldSeparator::FIELD_SEPARATOR) === true) {
162+
if (\str_contains($key, \Spameri\ElasticQuery\Mapping\Settings\Mapping\FieldSeparator::FIELD_SEPARATOR) === TRUE) {
163163
$levels = \explode(\Spameri\ElasticQuery\Mapping\Settings\Mapping\FieldSeparator::FIELD_SEPARATOR, $key);
164164

165-
$value = $this->source[$levels[0]] ?? null;
165+
$value = $this->source[$levels[0]] ?? NULL;
166166
unset($levels[0]);
167167

168168
foreach ($levels as $subKey) {
169-
$value = $value[$subKey] ?? null;
169+
$value = $value[$subKey] ?? NULL;
170+
}
170171

171-
if ($value !== null) {
172-
return $value;
173-
}
172+
if ($value !== NULL) {
173+
return $value;
174174
}
175175
}
176176

177-
return null;
177+
return NULL;
178178
}
179179

180180

0 commit comments

Comments
 (0)