Horde_Kolab_Format_Xml_Type_Composite::load PHP Method

load() public method

Load the node value from the Kolab object.
public load ( string $name, &$attributes, DOMNode $parent_node, Horde_Kolab_Format_Xml_Helper $helper, array $params = [] ) : DOMNode | boolean
$name string The name of the the attribute to be fetched.
$parent_node DOMNode The parent node of the node to be loaded.
$helper Horde_Kolab_Format_Xml_Helper A XML helper instance.
$params array Additiona parameters for this parse operation.
return DOMNode | boolean The named DOMNode or false if no node value was found.
    public function load($name, &$attributes, $parent_node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
    {
        if ($node = $helper->findNodeRelativeTo('./' . $name, $parent_node)) {
            $result = $this->loadNodeValue($node, $helper, $params);
        } else {
            $result = $this->loadMissing($name, $params);
        }
        if (!$this->merge) {
            $attributes[$name] = $result;
        } else {
            $attributes = array_merge($attributes, $result);
        }
        return false;
    }

Usage Example

Example #1
0
 /**
  * Load the node value from the Kolab object.
  *
  * @param string                        $name        The name of the the
  *                                                   attribute to be fetched.
  * @param array                         &$attributes The data array that
  *                                                   holds all attribute
  *                                                   values.
  * @param DOMNode                       $parent_node The parent node of the
  *                                                   node to be loaded.
  * @param Horde_Kolab_Format_Xml_Helper $helper      A XML helper instance.
  * @param array                         $params      Additiona parameters for
  *                                                   this parse operation.
  *
  * @return DOMNode|boolean The named DOMNode or false if no node value was
  *                         found.
  */
 public function load($name, &$attributes, $parent_node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
 {
     if (!($root = $helper->findNode('/' . $name))) {
         throw new Horde_Kolab_Format_Exception_InvalidRoot(sprintf('Missing root node "%s"!', $name));
     }
     $attributes['_format-version'] = $root->getAttribute('version');
     $attributes['_api-version'] = $params['api-version'];
     if (!$this->isRelaxed($params)) {
         if (version_compare($params['expected-version'], $attributes['_format-version']) < 0) {
             throw new Horde_Kolab_Format_Exception_InvalidRoot(sprintf('Not attempting to read higher root version of %s with our version %s!', $attributes['_format-version'], $params['expected-version']));
         }
     }
     $this->_prepareCompositeParameters($params, $attributes['_format-version']);
     parent::load($name, $attributes, $parent_node, $helper, $params);
     return $root;
 }
All Usage Examples Of Horde_Kolab_Format_Xml_Type_Composite::load