protected function getRelationshipPart( array $ids, $tag = 'footnotes' ) {
		$footnotes = [];
		$tag_name = rtrim( $tag, 's' );

		// get the path for the footnotes
		switch ( $tag ) {

			case 'endnotes':
				$target_path = $this->getTargetPath( self::ENDNOTES_SCHEMA, $tag );
				break;
			case 'hyperlink':
				$target_path = $this->getTargetPath( self::HYPERLINK_SCHEMA, $tag );
				break;
			default:
				$target_path = $this->getTargetPath( self::FOOTNOTES_SCHEMA, $tag );
				break;
		}

		// safety — if there are no footnotes, return
		if ( empty( $target_path ) ) {
			return false;
		}

		// if they are hyperlinks
		if ( is_array( $target_path ) ) {
			return $target_path;
		}

		$limit = count( $ids );

		// set it up
		$dom_doc = $this->getZipContent( $target_path );
		$doc_elem = $dom_doc->documentElement;

		// grab all the footnotes
		$text_tags = $doc_elem->getElementsByTagName( $tag_name );

		// TODO
		// could be more sophisticated
		if ( $text_tags->length !== $limit + 2 ) {
			throw new \Exception( 'mismatch between length of FootnoteReference array number of footnotes available' );
		}

		// get all the footnote ids
		// +2 to the domlist skips over two default nodes that don't contain end/footnotes
		for ( $i = 0; $i < $limit; $i++ ) {
			$footnotes[ $ids[ $i ] ] = $text_tags->item( $i + 2 )->nodeValue;
		}

		return $footnotes;
	}
protected function getRelationshipPart( array $ids, $tag = 'footnotes' ) {
		$footnotes = [];
		$tag_name = rtrim( $tag, 's' );

		// get the path for the footnotes
		switch ( $tag ) {

			case 'endnotes':
				$target_path = $this->getTargetPath( self::ENDNOTES_SCHEMA, $tag );
				break;
			case 'hyperlink':
				$target_path = $this->getTargetPath( self::HYPERLINK_SCHEMA, $tag );
				break;
			default:
				$target_path = $this->getTargetPath( self::FOOTNOTES_SCHEMA, $tag );
				break;
		}

		// safety — if there are no footnotes, return
		if ( empty( $target_path ) ) {
			return false;
		}

		// if they are hyperlinks
		if ( is_array( $target_path ) ) {
			return $target_path;
		}

		$limit = count( $ids );

		// set it up
		$dom_doc = $this->getZipContent( $target_path );
		$doc_elem = $dom_doc->documentElement;

		// grab all the footnotes
		$text_tags = $doc_elem->getElementsByTagName( $tag_name );

		// TODO
		// could be more sophisticated
		if ( $text_tags->length !== $limit + 2 ) {
			throw new \Exception( 'mismatch between length of FootnoteReference array number of footnotes available' );
		}

		// get all the footnote ids
		// +2 to the domlist skips over two default nodes that don't contain end/footnotes
		for ( $i = 0; $i < $limit; $i++ ) {
			$footnotes[ $ids[ $i ] ] = $text_tags->item( $i + 2 )->nodeValue;
		}

		return $footnotes;
	}
protected function getRelationshipPart ( array $ ids , $ tag = 'footnotes' ) { $ footnotes = [ ] ; $ tag_name = rtrim ( $ tag , 's' ) ; // get the path for the footnotes switch ( $ tag ) { case 'endnotes' : $ target_path = $ this -> getTargetPath ( self :: ENDNOTES_SCHEMA , $ tag ) ; break ; case 'hyperlink' : $ target_path = $ this -> getTargetPath ( self :: HYPERLINK_SCHEMA , $ tag ) ; break ; default : $ target_path = $ this -> getTargetPath ( self :: FOOTNOTES_SCHEMA , $ tag ) ; break ; } // safety — if there are no footnotes, return if ( empty ( $ target_path ) ) { return false ; } // if they are hyperlinks if ( is_array ( $ target_path ) ) { return $ target_path ; } $ limit = count ( $ ids ) ; // set it up $ dom_doc = $ this -> getZipContent ( $ target_path ) ; $ doc_elem = $ dom_doc -> documentElement ; // grab all the footnotes $ text_tags = $ doc_elem -> getElementsByTagName ( $ tag_name ) ; // TODO // could be more sophisticated if ( $ text_tags -> length !== $ limit + 2 ) { throw new \ Exception ( 'mismatch between length of FootnoteReference array number of footnotes available' ) ; } // get all the footnote ids // +2 to the domlist skips over two default nodes that don't contain end/footnotes for ( $ i = 0 ; $ i < $ limit ; $ i ++ ) { $ footnotes [ $ ids [ $ i ] ] = $ text_tags -> item ( $ i + 2 ) -> nodeValue ; } return $ footnotes ; }
Give this some ids and it returns an associative array of footnotes

@param array $ids
@param string $tag

@return array|bool
@throws \Exception if there is discrepancy between the number of footnotes in document.xml and footnotes.xml
Give this some ids and it returns an associative array of footnotes