public function complete()
{
$this->prepareClassList();
foreach ($this->definitions as $name => $def) {
if ($def->isDynamic()) {
continue;
}
$this->currentService = NULL;
$entity = $def->getFactory()->getEntity();
$serviceRef = $this->getServiceName($entity);
$factory = $serviceRef && !$def->getFactory()->arguments && !$def->getSetup() && $def->getImplementMode() !== $def::IMPLEMENT_MODE_CREATE ? new Statement(['@' . self::THIS_CONTAINER, 'getService'], [$serviceRef]) : $def->getFactory();
try {
$def->setFactory($this->completeStatement($factory));
$this->classListNeedsRefresh = FALSE;
$this->currentService = $name;
$setups = $def->getSetup();
foreach ($setups as &$setup) {
if (is_string($setup->getEntity()) && strpbrk($setup->getEntity(), ':@?\\') === FALSE) {
// auto-prepend @self
$setup = new Statement(['@' . $name, $setup->getEntity()], $setup->arguments);
}
$setup = $this->completeStatement($setup);
}
$def->setSetup($setups);
} catch (\Exception $e) {
throw new ServiceCreationException("Service '{$name}': " . $e->getMessage(), 0, $e);
} finally {
$this->currentService = NULL;
}
}
}