/** * @param string $id * @param array $args * * @return mixed * @throws ImplementationNotFoundException * @throws TypeMismatchException * @throws UnresolveableArgumentException * @throws ValueNotFoundException */ public function get($id, array $args = []) { return $this->rethrowExceptions(function () use($id, $args) { $value = null; $definition = $this->registry->getDefinition($id); if ($definition instanceof IDefinition) { $value = $this->resolver->resolveDefinition($definition, $id, $args); $this->processSingletonDefinition($definition, $id, $value); } if ($value === null) { return $this->resolver->resolveWithoutDefinition($id, $args); } return $value; }); }