Zephir\SymbolTable::getTempVariableForWrite PHP Method

getTempVariableForWrite() public method

Creates a temporary variable to be used in a write operation
public getTempVariableForWrite ( string $type, zephir\CompilationContext $context, $init = true ) : Variable
$type string
$context zephir\CompilationContext
return Variable
    public function getTempVariableForWrite($type, CompilationContext $context, $init = true)
    {
        $variable = $this->reuseTempVariable($type, 'heap');
        if (is_object($variable)) {
            $variable->increaseUses();
            $variable->increaseMutates();
            if ($init && ($type == 'variable' || $type == 'string' || $type == 'array')) {
                $variable->initVariant($context);
            }
            return $variable;
        }
        $tempVar = $this->getNextTempVar();
        $variable = $this->addVariable($type, '_' . $tempVar, $context);
        $variable->setIsInitialized(true, $context, array());
        $variable->setTemporal(true);
        $variable->increaseUses();
        $variable->increaseMutates();
        if ($type == 'variable' || $type == 'string' || $type == 'array') {
            $variable->initVariant($context);
        }
        $this->registerTempVariable($type, 'heap', $variable);
        return $variable;
    }