Fix PHPStan false-positive

This commit is contained in:
Sebastian Meyer 2024-01-12 07:18:09 +01:00
parent a2cb531bbc
commit c2f3e7493e
2 changed files with 9 additions and 5 deletions

View File

@ -121,7 +121,7 @@ class ListIdentifiers extends Middleware
} }
$header = $document->createElement('header'); $header = $document->createElement('header');
if ($oaiRecord->getContent() === null) { if (!$oaiRecord->hasContent()) {
$header->setAttribute('status', 'deleted'); $header->setAttribute('status', 'deleted');
} }
$baseNode->appendChild($header); $baseNode->appendChild($header);
@ -137,11 +137,13 @@ class ListIdentifiers extends Middleware
$header->appendChild($setSpec); $header->appendChild($setSpec);
} }
if ($verb === 'ListRecords' && $oaiRecord->getContent() !== null) { if ($verb === 'ListRecords' && $oaiRecord->hasContent()) {
$metadata = $document->createElement('metadata'); $metadata = $document->createElement('metadata');
$baseNode->appendChild($metadata); $baseNode->appendChild($metadata);
$data = $document->importData($oaiRecord->getContent()); /** @var string */
$content = $oaiRecord->getContent();
$data = $document->importData($content);
$metadata->appendChild($data); $metadata->appendChild($data);
} }
} }

View File

@ -94,8 +94,10 @@ class ListSets extends Middleware
$setDescription = $document->createElement('setDescription'); $setDescription = $document->createElement('setDescription');
$set->appendChild($setDescription); $set->appendChild($setDescription);
$description = $document->importData($oaiSet->getDescription()); /** @var string */
$setDescription->appendChild($description); $description = $oaiSet->getDescription();
$data = $document->importData($description);
$setDescription->appendChild($data);
} }
} }