codespell: CRM/*
[civicrm-core.git] / CRM / Utils / Tree.php
index 3996676473f6c4db75fe689738ea5781259e78c2..2bcfa98ada6174a2798ef2cdfe059648fb4d9f1f 100644 (file)
@@ -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.                                    |
  |                                                                    |
  | 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
  *
  *
  * @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 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,40 +144,38 @@ 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
-   *
-   * @return boolean
+   * @param array $node node which needs to checked
    *
+   * @return bool
    */
   public function isLeafNode(&$node) {
     return (count($node['children']) ? TRUE : FALSE);
   }
 
   /**
-   * Create a node
+   * Create a node.
    *
    * @param string $name
    *
-   * @return array (ref)
-   *
+   * @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
+   * 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
-   *
    */
   public function addNode($parentName, &$node) {
     $temp = '';
@@ -189,14 +185,13 @@ 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
-   *
    */
   public function addData($parentName, $childName, $data) {
     $temp = '';
@@ -211,26 +206,21 @@ class CRM_Utils_Tree {
   }
 
   /**
-   * Get Tree
-   *
-   * @param none
+   * Get Tree.
    *
    * @return tree
-   *
    */
   public function getTree() {
     return $this->tree;
   }
 
   /**
-   * Print the tree
-   *
-   * @param none
+   * Print the tree.
    *
    * @return void
-   *
    */
   public function display() {
     print_r($this->tree);
   }
+
 }