addInlineService example

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;
            }

            $c = $this->addInlineService($id$definition);

            if (!$isProxyCandidate && !$definition->isShared()) {
                $c = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $lineexplode("\n", $c)));
                $lazyloadInitialization = $definition->isLazy() ? ', $lazyLoad = true' : '';

                $c = sprintf(" %s = function (\$container%s) {\n%s };\n\n return %1\$s(\$container);\n", $factory$lazyloadInitialization$c);
            }

            $code .= $c;
        }

        
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;
            }

            $c = $this->addInlineService($id$definition);

            if (!$isProxyCandidate && !$definition->isShared()) {
                $c = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $lineexplode("\n", $c)));
                $lazyloadInitialization = $definition->isLazy() ? ', $lazyLoad = true' : '';

                $c = sprintf(" %s = function (\$container%s) {\n%s };\n\n return %1\$s(\$container);\n", $factory$lazyloadInitialization$c);
            }

            $code .= $c;
        }

        
$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;

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