private function offsetVariable(Node $var) {
    if ($this->currentType === '{') {
      $node = new ArrayLookupNode();
      $node->addChild($var, 'array');
      $this->mustMatch('{', $node);
      $node->addChild($this->expr(), 'key');
      $this->mustMatch('}', $node, NULL, TRUE);
      return $this->offsetVariable($node);
    }
    elseif ($this->currentType === '[') {
      $node = new ArrayLookupNode();
      $node->addChild($var, 'array');
      $this->dimOffset($node);
      return $this->offsetVariable($node);
    }
    else {
      return $var;
    }
  }
private function offsetVariable(Node $var) {
    if ($this->currentType === '{') {
      $node = new ArrayLookupNode();
      $node->addChild($var, 'array');
      $this->mustMatch('{', $node);
      $node->addChild($this->expr(), 'key');
      $this->mustMatch('}', $node, NULL, TRUE);
      return $this->offsetVariable($node);
    }
    elseif ($this->currentType === '[') {
      $node = new ArrayLookupNode();
      $node->addChild($var, 'array');
      $this->dimOffset($node);
      return $this->offsetVariable($node);
    }
    else {
      return $var;
    }
  }
private function offsetVariable ( Node $ var ) { if ( $ this -> currentType === '{' ) { $ node = new ArrayLookupNode ( ) ; $ node -> addChild ( $ var , 'array' ) ; $ this -> mustMatch ( '{' , $ node ) ; $ node -> addChild ( $ this -> expr ( ) , 'key' ) ; $ this -> mustMatch ( '}' , $ node , NULL , TRUE ) ; return $ this -> offsetVariable ( $ node ) ; } elseif ( $ this -> currentType === '[' ) { $ node = new ArrayLookupNode ( ) ; $ node -> addChild ( $ var , 'array' ) ; $ this -> dimOffset ( $ node ) ; return $ this -> offsetVariable ( $ node ) ; } else { return $ var ; } }
Apply any offset to variable.
@param Node $var
@return Node
Apply any offset to variable .