Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Jan 17, 2024
1 parent fe9134c commit 372f599
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/MainTransformer/MainTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,14 @@ public function transform(

// loop over the result and transform the source to the target

foreach ($searchResult as $searchEntry) {
foreach ($searchResult as $searchResultEntry) {
// if the target exists, we make sure it is of the same type as
// the target type of the search entry
// the target type of the search entry, if not continue to the next
// search entry

if ($target !== null) {
if (
!TypeCheck::isVariableInstanceOf($target, $searchEntry->getTargetType())
!TypeCheck::isVariableInstanceOf($target, $searchResultEntry->getTargetType())
) {
continue;
}
Expand All @@ -151,10 +152,10 @@ public function transform(
// TransformerInterface doesn't accept MixedType, so we need to
// convert it to null

$sourceType = $searchEntry->getSourceType();
$sourceType = $searchResultEntry->getSourceType();
$sourceTypeForTransformer = $sourceType instanceof MixedType ? null : $sourceType;

$targetType = $searchEntry->getTargetType();
$targetType = $searchResultEntry->getTargetType();
$targetTypeForTransformer = $targetType instanceof MixedType ? null : $targetType;

// if the target type is cached, return it. otherwise, pre-cache it
Expand All @@ -178,7 +179,7 @@ public function transform(
// get and prepare transformer
$transformer = $this->processTransformer(
$this->transformerRegistry->get(
$searchEntry->getTransformerServiceId()
$searchResultEntry->getTransformerServiceId()
)
);

Expand Down

0 comments on commit 372f599

Please sign in to comment.