Skip to content

Commit

Permalink
feat(RB): exchangeRates is null
Browse files Browse the repository at this point in the history
  • Loading branch information
h4kuna committed Jan 11, 2025
1 parent f2e6064 commit 78b018d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Driver/RB/Day.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use h4kuna\Exchange\Currency\Property;
use h4kuna\Exchange\Download\SourceData;
use h4kuna\Exchange\Driver\Source;
use h4kuna\Exchange\Exceptions\XmlResponseFailedException;
use h4kuna\Exchange\Utils;
use Psr\Http\Message\ResponseInterface;
use SimpleXMLElement;
Expand Down Expand Up @@ -53,6 +54,10 @@ public function createSourceData(ResponseInterface $response): SourceData
{
$xml = Utils::createSimpleXMLElement($response);

if ($xml->exchangeRateList?->exchangeRates === null) {
throw new XmlResponseFailedException((string) $response->getStatusCode());
}

// add CZK
$czk = $xml->exchangeRateList->exchangeRates->addChild('exchangeRate');
$czk->addChild('unitsFrom', '1');
Expand Down

0 comments on commit 78b018d

Please sign in to comment.