public function setScope($scope, $absolute = false)
	{
		$old = $this->scopeTree;

		if ($scope===null) {
			unset($this->scope);
			$this->scope = null;
		}

		if (is_array($scope)===false) {
			$scope = explode('.', $scope);
		}

		if ($absolute===true) {
			$this->scope =& $this->data;
			$this->scopeTree = array();
		}

		while (($bit = array_shift($scope)) !== null) {
			if ($bit === '_parent' || $bit === '_') {
				array_pop($this->scopeTree);
				reset($this->scopeTree);
				$this->scope =& $this->data;
				$cnt = count($this->scopeTree);
				for ($i=0;$i<$cnt;$i++)
					$this->scope =& $this->scope[$this->scopeTree[$i]];
			} elseif ($bit === '_root' || $bit === '__') {
				$this->scope =& $this->data;
				$this->scopeTree = array();
			} elseif (isset($this->scope[$bit])) {
				$this->scope =& $this->scope[$bit];
				$this->scopeTree[] = $bit;
			} else {
				$this->scope[$bit] = array();
				$this->scope =& $this->scope[$bit];
				$this->scopeTree[] = $bit;
			}
		}

		return $old;
	}
public function setScope($scope, $absolute = false)
	{
		$old = $this->scopeTree;

		if ($scope===null) {
			unset($this->scope);
			$this->scope = null;
		}

		if (is_array($scope)===false) {
			$scope = explode('.', $scope);
		}

		if ($absolute===true) {
			$this->scope =& $this->data;
			$this->scopeTree = array();
		}

		while (($bit = array_shift($scope)) !== null) {
			if ($bit === '_parent' || $bit === '_') {
				array_pop($this->scopeTree);
				reset($this->scopeTree);
				$this->scope =& $this->data;
				$cnt = count($this->scopeTree);
				for ($i=0;$i<$cnt;$i++)
					$this->scope =& $this->scope[$this->scopeTree[$i]];
			} elseif ($bit === '_root' || $bit === '__') {
				$this->scope =& $this->data;
				$this->scopeTree = array();
			} elseif (isset($this->scope[$bit])) {
				$this->scope =& $this->scope[$bit];
				$this->scopeTree[] = $bit;
			} else {
				$this->scope[$bit] = array();
				$this->scope =& $this->scope[$bit];
				$this->scopeTree[] = $bit;
			}
		}

		return $old;
	}
public function setScope ( $ scope , $ absolute = false ) { $ old = $ this -> scopeTree ; if ( $ scope === null ) { unset ( $ this -> scope ) ; $ this -> scope = null ; } if ( is_array ( $ scope ) === false ) { $ scope = explode ( '.' , $ scope ) ; } if ( $ absolute === true ) { $ this -> scope = & $ this -> data ; $ this -> scopeTree = array ( ) ; } while ( ( $ bit = array_shift ( $ scope ) ) !== null ) { if ( $ bit === '_parent' || $ bit === '_' ) { array_pop ( $ this -> scopeTree ) ; reset ( $ this -> scopeTree ) ; $ this -> scope = & $ this -> data ; $ cnt = count ( $ this -> scopeTree ) ; for ( $ i = 0 ; $ i < $ cnt ; $ i ++ ) $ this -> scope = & $ this -> scope [ $ this -> scopeTree [ $ i ] ] ; } elseif ( $ bit === '_root' || $ bit === '__' ) { $ this -> scope = & $ this -> data ; $ this -> scopeTree = array ( ) ; } elseif ( isset ( $ this -> scope [ $ bit ] ) ) { $ this -> scope = & $ this -> scope [ $ bit ] ; $ this -> scopeTree [ ] = $ bit ; } else { $ this -> scope [ $ bit ] = array ( ) ; $ this -> scope = & $ this -> scope [ $ bit ] ; $ this -> scopeTree [ ] = $ bit ; } } return $ old ; }
sets the scope

set to null if the scope becomes "unstable" (i.e. too variable or unknown) so that
variables are compiled in a more evaluative way than just $this->scope['key']

@param mixed $scope a string i.e. "level1.level2" or an array i.e. array("level1", "level2")
@param bool $absolute if true, the scope is set from the top level scope and not from the current scope
@return array the current scope tree
sets the scope