53 if (!isset($configuration[
'className']) && !isset($configuration[
'constructor']))
55 throw $this->buildBadRegistrationExceptions($id);
58 $furtherClassMetadata = $configuration[
'className'] ?? $configuration[
'constructor'];
60 $this->services[$id] = [$furtherClassMetadata, $configuration[
'constructorParams'] ?? []];
116 public function get(
string $id)
118 if (isset($this->instantiated[$id]))
120 return $this->instantiated[$id];
123 if (!isset($this->services[$id]))
125 throw $this->buildNotFoundException($id);
128 [$class, $args] = $this->services[$id];
130 if ($class instanceof \Closure)
136 if ($args instanceof \Closure)
140 $object =
new $class(...array_values($args));
143 $this->instantiated[$id] = $object;