shareService example



            if (\is_array($callable) && (
                $callable[0] instanceof Reference
                || $callable[0] instanceof Definition && !isset($inlineServices[spl_object_hash($callable[0])])
            )) {
                $initializer = function D) use ($callable, &$inlineServices) {
                    return $this->doResolveServices($callable[0]$inlineServices);
                };

                $proxy = eval('return '.LazyClosure::getCode('$initializer', $callable$definition$this$id).';');
                $this->shareService($definition$proxy$id$inlineServices);

                return $proxy;
            }
        }

        if (true === $tryProxy && $definition->isLazy() && ['Closure', 'fromCallable'] !== $definition->getFactory()
            && !$tryProxy = !($proxy = $this->proxyInstantiator ??= new LazyServiceInstantiator()) || $proxy instanceof RealServiceInstantiator
        ) {
            $proxy = $proxy->instantiateProxy(
                $this,
                (clone $definition)
                    


            if (\is_array($callable) && (
                $callable[0] instanceof Reference
                || $callable[0] instanceof Definition && !isset($inlineServices[spl_object_hash($callable[0])])
            )) {
                $initializer = function D) use ($callable, &$inlineServices) {
                    return $this->doResolveServices($callable[0]$inlineServices);
                };

                $proxy = eval('return '.LazyClosure::getCode('$initializer', $callable$definition$this$id).';');
                $this->shareService($definition$proxy$id$inlineServices);

                return $proxy;
            }
        }

        if (true === $tryProxy && $definition->isLazy() && ['Closure', 'fromCallable'] !== $definition->getFactory()
            && !$tryProxy = !($proxy = $this->proxyInstantiator ??= new LazyServiceInstantiator()) || $proxy instanceof RealServiceInstantiator
        ) {
            $proxy = $proxy->instantiateProxy(
                $this,
                (clone $definition)
                    
Home | Imprint | This part of the site doesn't use cookies.