original_string: 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;
  	}
code: 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;
  	}
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Add item to