src/ContainerBuilder.php
private function generateResolverMethods() : string
    {
        $buffer = "";

        foreach($this->services as $serviceName => $serviceDefinition)
        {
            $buffer .= "protected function " . $this->getResolverMethodName($serviceName) . "() {\n";

            $serviceClassName = $serviceDefinition->getClassName();

            if ($serviceClassName[0] !== "\\")
            {
                $serviceClassName = "\\" . $serviceClassName;
            }

            $buffer .= "\t\$instance = new " . $serviceClassName . "(". $this->generateArgumentsCode($serviceDefinition->getArguments()) .");\n";

            foreach($serviceDefinition->getMethodCalls() as list($callName, $callArguments))
            {
                $buffer .= "\t\$instance->" . $callName . '('. $this->generateArgumentsCode($callArguments) .");\n";
            }

            if (in_array($serviceName, $this->shared))
            {
                $buffer .= "\t\$this->resolvedSharedServices[" . var_export($serviceName, true) . "] = \$instance;\n";
            }

            $buffer .= "\treturn \$instance;\n";

            $buffer .= "}\n";
        }

        return $buffer;
    }
private function generateResolverMethods() : string
    {
        $buffer = "";

        foreach($this->services as $serviceName => $serviceDefinition)
        {
            $buffer .= "protected function " . $this->getResolverMethodName($serviceName) . "() {\n";

            $serviceClassName = $serviceDefinition->getClassName();

            if ($serviceClassName[0] !== "\\")
            {
                $serviceClassName = "\\" . $serviceClassName;
            }

            $buffer .= "\t\$instance = new " . $serviceClassName . "(". $this->generateArgumentsCode($serviceDefinition->getArguments()) .");\n";

            foreach($serviceDefinition->getMethodCalls() as list($callName, $callArguments))
            {
                $buffer .= "\t\$instance->" . $callName . '('. $this->generateArgumentsCode($callArguments) .");\n";
            }

            if (in_array($serviceName, $this->shared))
            {
                $buffer .= "\t\$this->resolvedSharedServices[" . var_export($serviceName, true) . "] = \$instance;\n";
            }

            $buffer .= "\treturn \$instance;\n";

            $buffer .= "}\n";
        }

        return $buffer;
    }
Generate the resolver methods

@return string