public function traverse_to( array $key_path ) {
		$current = array_shift( $key_path );

		if ( null === $current ) {
			return $this;
		}

		if ( ! $this->exists( $current ) ) {
			$exception = new NonExistentKeyException( "No data exists for key \"{$current}\"" );
			$exception->set_traverser( new static( $this->data, $current, $this->parent ) );
			throw $exception;
		}

		foreach ( $this->data as $key => &$key_data ) {
			if ( $key === $current ) {
				$traverser = new static( $key_data, $key, $this );
				return $traverser->traverse_to( $key_path );
			}
		}
	}
public function traverse_to( array $key_path ) {
		$current = array_shift( $key_path );

		if ( null === $current ) {
			return $this;
		}

		if ( ! $this->exists( $current ) ) {
			$exception = new NonExistentKeyException( "No data exists for key \"{$current}\"" );
			$exception->set_traverser( new static( $this->data, $current, $this->parent ) );
			throw $exception;
		}

		foreach ( $this->data as $key => &$key_data ) {
			if ( $key === $current ) {
				$traverser = new static( $key_data, $key, $this );
				return $traverser->traverse_to( $key_path );
			}
		}
	}
public function traverse_to ( array $ key_path ) { $ current = array_shift ( $ key_path ) ; if ( null === $ current ) { return $ this ; } if ( ! $ this -> exists ( $ current ) ) { $ exception = new NonExistentKeyException ( "No data exists for key \"{$current}\"" ) ; $ exception -> set_traverser ( new static ( $ this -> data , $ current , $ this -> parent ) ) ; throw $ exception ; } foreach ( $ this -> data as $ key => & $ key_data ) { if ( $ key === $ current ) { $ traverser = new static ( $ key_data , $ key , $ this ) ; return $ traverser -> traverse_to ( $ key_path ) ; } } }
Get an instance of the traverser for the given hierarchical key.

@param array $key_path Hierarchical key path within the current data to traverse to.

@throws NonExistentKeyException

@return static
Get an instance of the traverser for the given hierarchical key .