Skip to content

Commit

Permalink
Reduce duplication in the new class
Browse files Browse the repository at this point in the history
  • Loading branch information
LinaKind committed Dec 11, 2024
1 parent d4aa73b commit d6eb22d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ViewModel/Converter/TeaserTermsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ class TeaserTermsBuilder
{
public function build(ElifeAssessment $elifeAssessment)
{
$buildTermWithCorrectCasing = function (string $termValue) {
return new ViewModel\Term(ucfirst($termValue));
};

$significance = array_map(
function ($significanceValue) {
return new ViewModel\Term(ucfirst($significanceValue));
},
$buildTermWithCorrectCasing,
$elifeAssessment->getSignificance() ?? []
);

$strength = array_map(
function ($strengthValue) {
return new ViewModel\Term(ucfirst($strengthValue));
},
$buildTermWithCorrectCasing,
$elifeAssessment->getStrength() ?? []
);
return new TeaserTerms(array_merge($significance, $strength));
Expand Down

0 comments on commit d6eb22d

Please sign in to comment.