if (\
is_callable($callable)) { /** @var callable(Criteria, Context, \Shopware\Tests\Unit\Common\Stubs\DataAbstractionLayer\StaticEntityRepository<TEntityCollection>): ResultTypes $callable */
$result =
$callable($criteria,
$context,
$this);
} if ($result instanceof EntitySearchResult
) { return $result;
} if ($result instanceof EntityCollection
) { /** @var TEntityCollection $result */
return new EntitySearchResult($this->
getDummyEntityName(),
$result->
count(),
$result, null,
$criteria,
$context);
} if ($result instanceof AggregationResultCollection
) { /** @var TEntityCollection $collection */
$collection =
new EntityCollection();
return new EntitySearchResult($this->
getDummyEntityName(), 0,
$collection,
$result,
$criteria,
$context);
} throw new \
RuntimeException('Invalid mock repository configuration'
);
}