Zephir\SymbolTable::getTempVariableForObserve PHP Method

getTempVariableForObserve() public method

Creates a temporary variable to be used as intermediate variable of a read operation Variables are automatically tracked by the memory manager
public getTempVariableForObserve ( string $type, zephir\CompilationContext $context ) : Variable
$type string
$context zephir\CompilationContext
return Variable
    public function getTempVariableForObserve($type, CompilationContext $context)
    {
        $variable = $this->reuseTempVariable($type, 'observe');
        if (is_object($variable)) {
            $variable->increaseUses();
            $variable->increaseMutates();
            $variable->observeVariant($context);
            return $variable;
        }
        $tempVar = $this->getNextTempVar();
        $variable = $this->addVariable($type, '_' . $tempVar, $context);
        $variable->setIsInitialized(true, $context, array());
        $variable->setTemporal(true);
        $variable->increaseUses();
        $variable->increaseMutates();
        $variable->observeVariant($context);
        $this->registerTempVariable($type, 'observe', $variable);
        return $variable;
    }