public function addItem($relative_path, $id = '', array $properties = []){
		$id = $id ?: $this->pathToId($relative_path);
		// Avoid duplication
		foreach( $this->dom->manifest->item as $item ){
			/** @var \SimpleXMLElement $item */
			$attr = $item->attributes();
			if( isset($attr['id']) && $id == $attr['id'] ){
				return $id;
			}
		}
		// This is unique.
		$item = $this->dom->manifest->addChild('item');
		$item['id'] = $id;
		$item['href'] = $relative_path;
		$item['media-type'] = Mime::getTypeFromPath($relative_path);
		if( $properties ){
			$item['properties'] = implode(' ', $properties);
		}
		return $id;
	}
public function addItem($relative_path, $id = '', array $properties = []){
		$id = $id ?: $this->pathToId($relative_path);
		// Avoid duplication
		foreach( $this->dom->manifest->item as $item ){
			/** @var \SimpleXMLElement $item */
			$attr = $item->attributes();
			if( isset($attr['id']) && $id == $attr['id'] ){
				return $id;
			}
		}
		// This is unique.
		$item = $this->dom->manifest->addChild('item');
		$item['id'] = $id;
		$item['href'] = $relative_path;
		$item['media-type'] = Mime::getTypeFromPath($relative_path);
		if( $properties ){
			$item['properties'] = implode(' ', $properties);
		}
		return $id;
	}
public function addItem ( $ relative_path , $ id = '' , array $ properties = [ ] ) { $ id = $ id ? : $ this -> pathToId ( $ relative_path ) ; // Avoid duplication foreach ( $ this -> dom -> manifest -> item as $ item ) { /** @var \SimpleXMLElement $item */ $ attr = $ item -> attributes ( ) ; if ( isset ( $ attr [ 'id' ] ) && $ id == $ attr [ 'id' ] ) { return $ id ; } } // This is unique. $ item = $ this -> dom -> manifest -> addChild ( 'item' ) ; $ item [ 'id' ] = $ id ; $ item [ 'href' ] = $ relative_path ; $ item [ 'media-type' ] = Mime :: getTypeFromPath ( $ relative_path ) ; if ( $ properties ) { $ item [ 'properties' ] = implode ( ' ' , $ properties ) ; } return $ id ; }
Add item to

@param string $relative_path
@param string $id If empty, path will convert to id
@param array $properties Default empty. If set, properties will be set.
@return string
Add item to