X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FTree.php;h=2bcfa98ada6174a2798ef2cdfe059648fb4d9f1f;hb=b44e3f8468ceba3e1b321d31dd2e35a1aa1a5d9a;hp=b07ad4f6e46fbc61bd05c0d11cbd16b9d7a58cf9;hpb=49414d6faa37375cef1ea0a156054ddd9cc6ae8d;p=civicrm-core.git diff --git a/CRM/Utils/Tree.php b/CRM/Utils/Tree.php index b07ad4f6e4..2bcfa98ada 100644 --- a/CRM/Utils/Tree.php +++ b/CRM/Utils/Tree.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,12 +23,12 @@ | 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$ * */ @@ -63,7 +63,7 @@ * 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 @@ -73,14 +73,14 @@ * * * @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; @@ -103,16 +103,14 @@ class CRM_Utils_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) { @@ -146,17 +144,16 @@ class CRM_Utils_Tree { * 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 * @@ -164,19 +161,19 @@ class CRM_Utils_Tree { * (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 */ @@ -188,12 +185,11 @@ class CRM_Utils_Tree { } /** - * 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 */ @@ -210,9 +206,7 @@ class CRM_Utils_Tree { } /** - * Get Tree - * - * @param none + * Get Tree. * * @return tree */ @@ -221,13 +215,12 @@ class CRM_Utils_Tree { } /** - * Print the tree - * - * @param none + * Print the tree. * * @return void */ public function display() { print_r($this->tree); } + }