Small Horde_Tree:: cleanups.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Aug 2010 23:01:53 +0000 (17:01 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 19 Aug 2010 17:01:15 +0000 (11:01 -0600)
Slightly less verbose variable names.
Implement Countable interface.

framework/Core/lib/Horde/Core/Tree/Javascript.php
framework/Tree/lib/Horde/Tree.php

index 986e3cf..547cf15 100644 (file)
@@ -70,8 +70,8 @@ class Horde_Core_Tree_Javascript extends Horde_Core_Tree_Html
         $this->_static = $static;
 
         $opts = array(
-            'extraColsLeft' => $this->_extra_cols_left,
-            'extraColsRight' => $this->_extra_cols_right,
+            'extraColsLeft' => $this->_colsLeft,
+            'extraColsRight' => $this->_colsRight,
             'header' => $this->_header,
             'options' => $this->_options,
             'target' => $this->_instance,
index 72a28a0..2abef21 100644 (file)
  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
  * @package  Tree
  */
-class Horde_Tree
+class Horde_Tree implements Countable
 {
-    /**
-     * Display extra columns to the left of the main tree.
-     */
+    /* Display extra columns. */
     const EXTRA_LEFT = 0;
-
-    /**
-     * Display extra columns to the right of the main tree.
-     */
     const EXTRA_RIGHT = 1;
 
     /**
@@ -65,7 +59,7 @@ class Horde_Tree
      *
      * @var integer
      */
-    protected $_extra_cols_left = 0;
+    protected $_colsLeft = 0;
 
     /**
      * Keep count of how many extra columns there are on the right side
@@ -73,7 +67,7 @@ class Horde_Tree
      *
      * @var integer
      */
-    protected $_extra_cols_right = 0;
+    protected $_colsRight = 0;
 
     /**
      * Option values.
@@ -380,15 +374,15 @@ class Horde_Tree
         switch ($side) {
         case self::EXTRA_LEFT:
             $this->_nodes[$id]['extra'][self::EXTRA_LEFT] = $extra;
-            if ($col_count > $this->_extra_cols_left) {
-                $this->_extra_cols_left = $col_count;
+            if ($col_count > $this->_colsLeft) {
+                $this->_colsLeft = $col_count;
             }
             break;
 
         case self::EXTRA_RIGHT:
             $this->_nodes[$id]['extra'][self::EXTRA_RIGHT] = $extra;
-            if ($col_count > $this->_extra_cols_right) {
-                $this->_extra_cols_right = $col_count;
+            if ($col_count > $this->_colsRight) {
+                $this->_colsRight = $col_count;
             }
             break;
         }
@@ -506,4 +500,11 @@ class Horde_Tree
         return rawurlencode($id);
     }
 
+    /* Countable methods. */
+
+    public function count()
+    {
+        return count($this->_nodes);
+    }
+
 }