public function resolve(Definition $definition)
{
$factory = $this->resolveFactory($definition);
if (is_string($factory)) {
return $this->resolveFactoryFunction($factory);
}
if (is_array($factory) && $factory[0] instanceof Reference) {
return $this->resolveFactoryServiceWithMethod((string) $factory[0], $factory[1]);
}
if (is_array($factory) && $factory[0] instanceof Definition) {
return $this->resolveFactoryServiceDefinitionWithMethod($factory[0], $factory[1]);
}
if (is_array($factory)) {
return $this->resolveFactoryClassWithMethod($factory[0], $factory[1]);
}
if ($definition->getClass()) {
return $this->resolveClassWithConstructor($definition->getClass());
}
return null;
}