Skip to content

Commit

Permalink
Refactor PersonNamePopulator fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
mike4git authored and jdreesen committed Jan 31, 2023
1 parent fa4a45f commit 35c6293
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/Fixtures/Populator/PersonNamePopulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ class PersonNamePopulator implements Populator
{
public function populate(object $target, object $source, ?object $ctx = null): void
{
$separator = $ctx?->getValue('separator') ?? ' ';
$separator = ' ';
if ($ctx?->hasKey('separator')) {
$separator = $ctx->getValue('separator');
}

$target->setFullName(implode($separator, [$source->getFirstname(), $source->getLastname()]));
$target->setFullName(implode(
$separator,
[
$source->getFirstname(),
$source->getLastname()
]
));
}
}

0 comments on commit 35c6293

Please sign in to comment.