private function doTraverse($node, $path = array())
    {
        foreach ($node as $name => $value) {
            $path[] = $name;
            $value = $this->doVisit($path, $value, self::BEFORE);

            if (is_array($value)) {
                $value = $this->doTraverse($value, $path);
            }

            $value = $this->doVisit($path, $value, self::AFTER);
            $node[$name] = $value;
            array_pop($path);
        }

        return $node;
    }
private function doTraverse($node, $path = array())
    {
        foreach ($node as $name => $value) {
            $path[] = $name;
            $value = $this->doVisit($path, $value, self::BEFORE);

            if (is_array($value)) {
                $value = $this->doTraverse($value, $path);
            }

            $value = $this->doVisit($path, $value, self::AFTER);
            $node[$name] = $value;
            array_pop($path);
        }

        return $node;
    }
private function doTraverse ( $ node , $ path = array ( ) ) { foreach ( $ node as $ name => $ value ) { $ path [ ] = $ name ; $ value = $ this -> doVisit ( $ path , $ value , self :: BEFORE ) ; if ( is_array ( $ value ) ) { $ value = $ this -> doTraverse ( $ value , $ path ) ; } $ value = $ this -> doVisit ( $ path , $ value , self :: AFTER ) ; $ node [ $ name ] = $ value ; array_pop ( $ path ) ; } return $ node ; }
Recursive traversal implementation

@param mixed $node
@param array $path
@return mixed
Recursive traversal implementation