+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
* All nodes of the tree (including root and leaf node) contain the following properties
* Name - what is the node name ?
* Children - who are it's children
- * Data - any other auxillary data
+ * Data - any other auxiliary data
*
*
* Internally all nodes are an array with the following keys
*
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id: $
*
*/
class CRM_Utils_Tree {
/**
- * Store the tree information as a string or array
+ * Store the tree information as a string or array.
* @var string|array
*/
private $tree;
}
/**
- * Find a node that matches the given string
+ * Find a node that matches the given string.
*
* @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
+ * @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.
* Currently leaf nodes are strings and non-leaf nodes are arrays
*
- * @param array(
- ref) $node node which needs to checked
+ * @param array $node node which needs to checked
*
- * @return boolean
+ * @return bool
*/
public function isLeafNode(&$node) {
return (count($node['children']) ? TRUE : FALSE);
}
/**
- * Create a node
+ * Create a node.
*
* @param string $name
*
* (ref)
*/
public function &createNode($name) {
- $node['name'] = $name;
+ $node['name'] = $name;
$node['children'] = array();
- $node['data'] = array();
+ $node['data'] = array();
return $node;
}
/**
- * Add node
+ * Add node.
*
* @param string $parentName
* Name of the parent ?.
- * @param array (ref) - node to be added
+ * @param array (ref) $node - node to be added
*
* @return void
*/
}
/**
- * Add Data
+ * 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
*/
}
/**
- * Get Tree
- *
- * @param none
+ * Get Tree.
*
* @return tree
*/
}
/**
- * Print the tree
- *
- * @param none
+ * Print the tree.
*
* @return void
*/
public function display() {
print_r($this->tree);
}
+
}