public function toPhpCode(string $containerVariable, array $usedVariables = array()): InlineEntryInterface
    {
        if ($this->identifier !== null) {
            $variableName = $this->getIdentifier();
        } else {
            $variableName = $this->className;
        }
        $variableName = VariableUtils::getNextAvailableVariableName(lcfirst($variableName), $usedVariables);

        $usedVariables[] = $variableName;
        $dumpedArguments = ValueUtils::dumpArguments($this->constructorArguments, $containerVariable, $usedVariables);
        $prependedCode = $dumpedArguments->getStatements();
        $code = sprintf("%s = new %s(%s);\n", $variableName, $this->className, $dumpedArguments->getExpression());
        foreach ($this->actions as $action) {
            $inlineCode = $action->toPhpCode($variableName, $containerVariable, $usedVariables);
            $code .= $inlineCode->getStatements()."\n";
            $usedVariables = $inlineCode->getUsedVariables();
        }

        return new InlineEntry($variableName, $prependedCode.$code, $usedVariables);
    }
public function toPhpCode(string $containerVariable, array $usedVariables = array()): InlineEntryInterface
    {
        if ($this->identifier !== null) {
            $variableName = $this->getIdentifier();
        } else {
            $variableName = $this->className;
        }
        $variableName = VariableUtils::getNextAvailableVariableName(lcfirst($variableName), $usedVariables);

        $usedVariables[] = $variableName;
        $dumpedArguments = ValueUtils::dumpArguments($this->constructorArguments, $containerVariable, $usedVariables);
        $prependedCode = $dumpedArguments->getStatements();
        $code = sprintf("%s = new %s(%s);\n", $variableName, $this->className, $dumpedArguments->getExpression());
        foreach ($this->actions as $action) {
            $inlineCode = $action->toPhpCode($variableName, $containerVariable, $usedVariables);
            $code .= $inlineCode->getStatements()."\n";
            $usedVariables = $inlineCode->getUsedVariables();
        }

        return new InlineEntry($variableName, $prependedCode.$code, $usedVariables);
    }
Returns an InlineEntryInterface object representing the PHP code necessary to generate
the container entry.

@param string $containerVariable The name of the variable that allows access to the container instance. For instance: "$container", or "$this->container"
@param array  $usedVariables     An array of variables that are already used and that should not be used when generating this code.

@return InlineEntryInterface