protected function selectedForImport( \SimpleXMLElement $xml, array $match_ids ) {
		$selected_for_import = [];
		foreach ( $xml->spine->children() as $item ) {
			/** @var \SimpleXMLElement $item */
			// Get attributes
			$id = '';
			foreach ( $item->attributes() as $key => $val ) {
				if ( 'idref' === $key ) {
					$id = (string) $val;
				}
			}
			//Check this manifest item exists or not
			if ( isset( $this->manifest[ $id ] ) ) {
				// Flag
				$href = (string) $this->manifest[ $id ]['href'];
				if ( 'OEBPS/copyright.html' === $href ) {
					$this->pbCheck( $href );
				}
				// Skip
				if ( ! $this->flaggedForImport( $id ) ) {
					continue;
				}
				if ( ! isset( $match_ids[ $id ] ) ) {
					continue;
				}

				$selected_for_import[] = $id;
			}
		}

		return $selected_for_import;
	}
protected function selectedForImport( \SimpleXMLElement $xml, array $match_ids ) {
		$selected_for_import = [];
		foreach ( $xml->spine->children() as $item ) {
			/** @var \SimpleXMLElement $item */
			// Get attributes
			$id = '';
			foreach ( $item->attributes() as $key => $val ) {
				if ( 'idref' === $key ) {
					$id = (string) $val;
				}
			}
			//Check this manifest item exists or not
			if ( isset( $this->manifest[ $id ] ) ) {
				// Flag
				$href = (string) $this->manifest[ $id ]['href'];
				if ( 'OEBPS/copyright.html' === $href ) {
					$this->pbCheck( $href );
				}
				// Skip
				if ( ! $this->flaggedForImport( $id ) ) {
					continue;
				}
				if ( ! isset( $match_ids[ $id ] ) ) {
					continue;
				}

				$selected_for_import[] = $id;
			}
		}

		return $selected_for_import;
	}
protected function selectedForImport ( \ SimpleXMLElement $ xml , array $ match_ids ) { $ selected_for_import = [ ] ; foreach ( $ xml -> spine -> children ( ) as $ item ) { /** @var \SimpleXMLElement $item */ // Get attributes $ id = '' ; foreach ( $ item -> attributes ( ) as $ key => $ val ) { if ( 'idref' === $ key ) { $ id = ( string ) $ val ; } } //Check this manifest item exists or not if ( isset ( $ this -> manifest [ $ id ] ) ) { // Flag $ href = ( string ) $ this -> manifest [ $ id ] [ 'href' ] ; if ( 'OEBPS/copyright.html' === $ href ) { $ this -> pbCheck ( $ href ) ; } // Skip if ( ! $ this -> flaggedForImport ( $ id ) ) { continue ; } if ( ! isset ( $ match_ids [ $ id ] ) ) { continue ; } $ selected_for_import [ ] = $ id ; } } return $ selected_for_import ; }
Iterate each spine and get each manifest item in the order of spine

@param \SimpleXMLElement $xml
@param array $match_ids

@return int[]
Iterate each spine and get each manifest item in the order of spine