Simplify getOption()
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 23 Aug 2010 23:28:08 +0000 (17:28 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 24 Aug 2010 06:00:58 +0000 (00:00 -0600)
framework/Tree/lib/Horde/Tree.php
framework/Tree/lib/Horde/Tree/Html.php

index 6ec3073..16d8203 100644 (file)
@@ -217,32 +217,15 @@ class Horde_Tree implements Countable
     /**
      * Gets an option's value.
      *
-     * @param string $option   The name of the option to fetch.
-     * @param boolean $html    Whether to format the return value in HTML.
-     * @param string $default  A default value to use in case none is set for
-     *                         the requested option.
+     * @param string $option  The name of the option to fetch.
      *
      * @return mixed  The option's value.
      */
-    public function getOption($option, $html = false, $default = null)
+    public function getOption($option)
     {
-        $value = null;
-
-        if (!isset($this->_options[$option]) && !is_null($default)) {
-            /* Requested option has not been but there is a
-             * default. */
-            $value = $default;
-        } elseif (isset($this->_options[$option])) {
-            /* Requested option has been set, get its value. */
-            $value = $this->_options[$option];
-        }
-
-        if ($html && !is_null($value)) {
-            /* Format value for html output. */
-            $value = sprintf(' %s="%s"', $option, $value);
-        }
-
-        return $value;
+        return isset($this->_options[$option])
+            ? $this->_options[$option]
+            : null;
     }
 
     /**
index 432a8b5..29653ab 100644 (file)
@@ -89,15 +89,27 @@ class Horde_Tree_Html extends Horde_Tree
      * @param array $params  Additional parameters:
      * <pre>
      * alternate - (boolean) Alternate shading in the table?
+     *             DEFAULT: false
      * class - (string) The class to use for the table.
+     *         DEFAULT: ''
      * hideHeaders - (boolean) Don't render any HTML for the header row, just
      *               use the widths.
+     *               DEFAULT: false
      * lines - (boolean) Show tree lines?
+     *         DEFAULT: true
+     * lines_base - (boolean) Show tree lines for the base level? Requires
+     *              'lines' to be true also.
+     *              DEFAULT: false
      * multiline - (boolean) Do the node labels contain linebreaks?
+     *             DEFAULT: false
      * </pre>
      */
     public function __construct($name, array $params = array())
     {
+        $params = array_merge(array(
+            'lines' => true
+        ), $params);
+
         parent::__construct($name, $params);
     }