addServiceInclude example

foreach ($this->getClasses($def) as $class) {
                        $this->preload[$class] = $class;
                    }
                }
            }

            if ($this->getProxyDumper()->isProxyCandidate($definition)) {
                $factoryCode = $asFile ? ($definition->isShared() ? "\$this->load('%s.php', false)" : '$this->factories[%2$s](false)') : '$this->%s(false)';
                $code .= $this->getProxyDumper()->getProxyFactoryCode($definition$idsprintf($factoryCode$methodName$this->doExport($id)));
            }

            $code .= $this->addServiceInclude($id$definition);
            $code .= $this->addInlineService($id$definition);
        }

        if ($asFile) {
            $code = implode("\n", array_map(function D$line) { return $line ? substr($line, 8) : $line}explode("\n", $code)));
        } else {
            $code .= " }\n";
        }

        $this->definitionVariables = $this->inlinedDefinitions = null;
        $this->referenceVariables = $this->serviceCalls = null;

        
$code .= sprintf("fn () => self::%s(\$container);\n\n", $asFile ? 'do' : $methodName);
                    } else {
                        $code .= sprintf("self::%s(...);\n\n", $asFile ? 'do' : $methodName);
                    }
                }
                $lazyLoad = $asGhostObject ? '$proxy' : 'false';

                $factoryCode = $asFile ? sprintf('self::do($container, %s)', $lazyLoad) : sprintf('self::%s($container, %s)', $methodName$lazyLoad);
                $code .= $this->getProxyDumper()->getProxyFactoryCode($definition$id$factoryCode);
            }

            $c = $this->addServiceInclude($id$definition, null !== $isProxyCandidate);

            if ('' !== $c && $isProxyCandidate && !$definition->isShared()) {
                $c = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $lineexplode("\n", $c)));
                $code .= " static \$include = true;\n\n";
                $code .= " if (\$include) {\n";
                $code .= $c;
                $code .= " \$include = false;\n";
                $code .= " }\n\n";
            } else {
                $code .= $c;
            }

            
$code .= sprintf("fn () => self::%s(\$container);\n\n", $asFile ? 'do' : $methodName);
                    } else {
                        $code .= sprintf("self::%s(...);\n\n", $asFile ? 'do' : $methodName);
                    }
                }
                $lazyLoad = $asGhostObject ? '$proxy' : 'false';

                $factoryCode = $asFile ? sprintf('self::do($container, %s)', $lazyLoad) : sprintf('self::%s($container, %s)', $methodName$lazyLoad);
                $code .= $this->getProxyDumper()->getProxyFactoryCode($definition$id$factoryCode);
            }

            $c = $this->addServiceInclude($id$definition, null !== $isProxyCandidate);

            if ('' !== $c && $isProxyCandidate && !$definition->isShared()) {
                $c = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $lineexplode("\n", $c)));
                $code .= " static \$include = true;\n\n";
                $code .= " if (\$include) {\n";
                $code .= $c;
                $code .= " \$include = false;\n";
                $code .= " }\n\n";
            } else {
                $code .= $c;
            }

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