Horde_Pear_Package_Xml_Element_Directory::insertFile PHP Method

insertFile() public method

Insert a new file entry into the XML at the given point with the specified name and file role.
public insertFile ( string $name, string $role, DOMNode $point = null ) : Horde_Pear_Package_Xml_Element_File
$name string The name.
$role string The role.
$point DOMNode Insertion point.
return Horde_Pear_Package_Xml_Element_File The inserted element.
    public function insertFile($name, $role, DOMNode $point = null)
    {
        $element = $this->_xml->createElementFile($name, $this, $role);
        $element->insert($point);
        return $element;
    }

Usage Example

Example #1
0
 /**
  * Add a file to the list.
  *
  * @param string $file   The file name.
  * @param array  $params Additional file parameters.
  *
  * @return NULL
  */
 private function _addFile($file, $params)
 {
     $this->_files[basename($file)] = $this->_element->insertFile(basename($file), $params['role'], $this->_getFileInsertionPoint(basename($file)));
 }