Whups_Query::hoist PHP Method

hoist() public method

public hoist ( $pathstring )
    public function hoist($pathstring)
    {
        $path = Whups_Query::stringToPath($pathstring);
        $qobj =& $this->query;
        if (!strlen($pathstring)) {
            // Can't hoist the root node.
        } else {
            $count = count($path) - 1;
            for ($i = 0; $i < $count; $i++) {
                $qobj =& $qobj['children'][$path[$i]];
            }
            $cobj =& $qobj['children'][$path[$count]];
            // TODO: make sure we're hoisting a branch.
            array_splice($qobj['children'], $path[$count], 0, $cobj['children']);
            array_splice($cobj['children'], 0, count($cobj['children']));
        }
    }