Skip to content

Commit

Permalink
Delegate ElifeAssessment normalization to ElifeAssessmentNormalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiosironi committed Jan 15, 2025
1 parent 9009b87 commit 3f9d0e5
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/Serializer/ArticleVoRNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,27 +442,7 @@ protected function normalizeArticle(
}

if ($article->getElifeAssessment()) {
$data['elifeAssessment'] = [
'title' => $article->getElifeAssessment()->getTitle(),
];
$data['elifeAssessment']['content'] = $article
->getElifeAssessment()
->getArticleSection()
->getContent()
->map(function (Block $block) use ($format, $context) {
return $this->normalizer->normalize($block, $format, $context);
})
->toArray();

$data['elifeAssessment']['doi'] = $article->getElifeAssessment()->getArticleSection()->getDoi();
$data['elifeAssessment']['id'] = $article->getElifeAssessment()->getArticleSection()->getId();

if ($article->getElifeAssessment()->getSignificance() !== null) {
$data['elifeAssessment']['significance'] = $article->getElifeAssessment()->getSignificance();
}
if ($article->getElifeAssessment()->getStrength() !== null) {
$data['elifeAssessment']['strength'] = $article->getElifeAssessment()->getStrength();
}
$data['elifeAssessment'] = $this->normalizer->normalize($article->getElifeAssessment(), $format, $context);
}

if (empty($context['snippet'])) {
Expand Down

0 comments on commit 3f9d0e5

Please sign in to comment.