/**
* {@inheritdoc}
*
* @throws InstantiationException
*/
public function instantiate(FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, GenerationContext $context) : ResolvedFixtureSet
{
try {
$instance = $this->createInstance($fixture);
} catch (InstantiationThrowable $throwable) {
throw $throwable;
} catch (\Throwable $throwable) {
throw InstantiationExceptionFactory::create($fixture, 0, $throwable);
}
$objects = $fixtureSet->getObjects()->with(new SimpleObject($fixture->getId(), $instance));
return $fixtureSet->withObjects($objects);
}