From: Michael M Slusarz Date: Wed, 18 Aug 2010 23:01:53 +0000 (-0600) Subject: Small Horde_Tree:: cleanups. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=eabc6c29cadce707f1a16b1cd38f98c1fa63a2e8;p=horde.git Small Horde_Tree:: cleanups. Slightly less verbose variable names. Implement Countable interface. --- diff --git a/framework/Core/lib/Horde/Core/Tree/Javascript.php b/framework/Core/lib/Horde/Core/Tree/Javascript.php index 986e3cfcb..547cf1572 100644 --- a/framework/Core/lib/Horde/Core/Tree/Javascript.php +++ b/framework/Core/lib/Horde/Core/Tree/Javascript.php @@ -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, diff --git a/framework/Tree/lib/Horde/Tree.php b/framework/Tree/lib/Horde/Tree.php index 72a28a0c4..2abef21c7 100644 --- a/framework/Tree/lib/Horde/Tree.php +++ b/framework/Tree/lib/Horde/Tree.php @@ -13,16 +13,10 @@ * @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); + } + }