LazyServiceInstantiator example

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)
                    ->setClass($class)
                    ->setTags(($definition->hasTag('proxy') ? ['proxy' => $parameterBag->resolveValue($definition->getTag('proxy'))] : []) + $definition->getTags()),
                $idfunction D$proxy = false) use ($definition, &$inlineServices$id) {
                    return $this->createService($definition$inlineServices, true, $id$proxy);
                }
            );
            $this->shareService($definition$proxy$id$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)
                    ->setClass($class)
                    ->setTags(($definition->hasTag('proxy') ? ['proxy' => $parameterBag->resolveValue($definition->getTag('proxy'))] : []) + $definition->getTags()),
                $idfunction D$proxy = false) use ($definition, &$inlineServices$id) {
                    return $this->createService($definition$inlineServices, true, $id$proxy);
                }
            );
            $this->shareService($definition$proxy$id$inlineServices);

            
Home | Imprint | This part of the site doesn't use cookies.