Skip to content

Commit

Permalink
Handle the edge cases for fetching the warning advice data.
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit-rocks committed Feb 23, 2024
1 parent 5ce5e51 commit a5baaf7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Warning/Serializer/WarningInfoNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public function setTextValue(array $text, WarningInfo $warningInfo): void {
match ($text['@type']) {
'warning_title' => $warningInfo->setWarningTitle($value),
'preamble' => $warningInfo->setPreamble($value),
'warning_advice' => \array_map(function ($advice) use ($warningInfo): void {
'warning_advice' => \is_array($value) ? \array_map(function ($advice) use ($warningInfo): void {
$warningInfo->setWarningAdvice($advice);
}, $this->accessWeatherData($text, 'p')),
}, $value) : $warningInfo->setWarningAdvice($value),
'warning_next_issue' => $warningInfo->setWarningNextIssue($value),
default => '',
};
Expand Down

0 comments on commit a5baaf7

Please sign in to comment.