<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
/**
* Constructor for the tree.
*
- * @param $nodeName
+ * @param string $nodeName
*
* @internal param string $rootNode
*
* @return CRM_Utils_Tree
- * @access public
*/
public function __construct($nodeName) {
// create the root node
/**
* Find a node that matches the given string
*
- * @param string $name name of the node we are searching for.
+ * @param string $name
+ * Name of the node we are searching for.
* @param array (ref) $parentNode which parent node should we search in ?
*
- * @return array(
- ref) | false node if found else false
- *
- * @access public
+ * @return array(ref) | false node if found else false
*/
- //public function &findNode(&$parentNode, $name)
public function &findNode($name, &$parentNode) {
// if no parent node specified, please start from root node
if (!$parentNode) {
}
/**
- * check if node is a leaf node.
+ * Check if node is a leaf node.
* Currently leaf nodes are strings and non-leaf nodes are arrays
*
- * @param array(
- ref) $node node which needs to checked
- *
- * @return boolean
+ * @param array $node node which needs to checked
*
- * @access public
+ * @return bool
*/
public function isLeafNode(&$node) {
return (count($node['children']) ? TRUE : FALSE);
*
* @param string $name
*
- * @return array (ref)
- *
- * @access public
+ * @return array
+ * (ref)
*/
public function &createNode($name) {
- $node['name'] = $name;
+ $node['name'] = $name;
$node['children'] = array();
- $node['data'] = array();
+ $node['data'] = array();
return $node;
}
/**
* Add node
*
- * @param string $parentName - name of the parent ?
- * @param array (ref) - node to be added
+ * @param string $parentName
+ * Name of the parent ?.
+ * @param array (ref) $node - node to be added
*
* @return void
- *
- * @access public
*/
public function addNode($parentName, &$node) {
$temp = '';
/**
* Add Data
*
- * @param string $parentName - name of the parent ?
- * @param mixed - data to be added
- * @param string - key to be used (optional)
+ * @param string $parentName Name of the parent ?.
+ * @param string $childName - key to be used (optional)
+ * @param mixed $data - data to be added
*
* @return void
- *
- * @access public
*/
public function addData($parentName, $childName, $data) {
$temp = '';
/**
* Get Tree
*
- * @param none
- *
* @return tree
- *
- * @access public
*/
public function getTree() {
return $this->tree;
}
/**
- * print the tree
- *
- * @param none
+ * Print the tree
*
* @return void
- *
- * @access public
*/
public function display() {
print_r($this->tree);
}
-}
+}