From a0f38f5fd87ca6e5a5cab916e48c15877d52b3b1 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 12 Apr 2016 07:46:30 -0400
Subject: [PATCH] Small code style improvements

---
 program/include/rcmail.php      |   10 ++++++----
 tests/Framework/LdapGeneric.php |    2 +-
 program/lib/Roundcube/html.php  |   16 +++++++++-------
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 1ff42b4..f97e659 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -2171,7 +2171,7 @@
     /**
      * Returns supported font-family specifications
      *
-     * @param string $font  Font name
+     * @param string $font Font name
      *
      * @param string|array Font-family specification array or string (if $font is used)
      */
@@ -2203,8 +2203,8 @@
     /**
      * Create a human readable string for a number of bytes
      *
-     * @param int    Number of bytes
-     * @param string Size unit
+     * @param int    $bytes Number of bytes
+     * @param string &$unit Size unit
      *
      * @return string Byte string
      */
@@ -2235,7 +2235,7 @@
     /**
      * Returns real size (calculated) of the message part
      *
-     * @param rcube_message_part  Message part
+     * @param rcube_message_part $part Message part
      *
      * @return string Part size (and unit)
      */
@@ -2319,6 +2319,8 @@
      * Get resource file content (with assets_dir support)
      *
      * @param string $name File name
+     *
+     * @return string File content
      */
     public function get_resource_content($name)
     {
diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php
index 9cdc971..8c2534a 100644
--- a/program/lib/Roundcube/html.php
+++ b/program/lib/Roundcube/html.php
@@ -25,14 +25,15 @@
 class html
 {
     protected $tagname;
+    protected $content;
     protected $attrib  = array();
     protected $allowed = array();
-    protected $content;
 
     public static $doctype = 'xhtml';
     public static $lc_tags = true;
     public static $common_attrib = array('id','class','style','title','align','unselectable','tabindex','role');
-    public static $containers = array('iframe','div','span','p','h1','h2','h3','ul','form','textarea','table','thead','tbody','tr','th','td','style','script');
+    public static $containers    = array('iframe','div','span','p','h1','h2','h3','ul','form','textarea','table','thead','tbody','tr','th','td','style','script');
+    public static $bool_attrib   = array('checked','multiple','disabled','selected','autofocus','readonly');
 
 
     /**
@@ -279,7 +280,7 @@
     /**
      * Create string with attributes
      *
-     * @param array $attrib  Associative arry with tag attributes
+     * @param array $attrib  Associative array with tag attributes
      * @param array $allowed List of allowed attributes
      *
      * @return string Valid attribute string
@@ -319,8 +320,9 @@
             }
 
             // attributes with no value
-            if (in_array($key, array('checked', 'multiple', 'disabled', 'selected', 'autofocus'))) {
+            if (in_array($key, self::$bool_attrib)) {
                 if ($value) {
+                    // @TODO: minimize attribute in non-xhtml mode
                     $attrib_arr[] = $key . '="' . $key . '"';
                 }
             }
@@ -460,7 +462,7 @@
     protected $tagname = 'input';
     protected $type    = 'hidden';
     protected $allowed = array('type','name','value','onchange','disabled','readonly');
-    protected $fields_arr = array();
+    protected $fields  = array();
 
     /**
      * Constructor
@@ -481,7 +483,7 @@
      */
     public function add($attrib)
     {
-        $this->fields_arr[] = $attrib;
+        $this->fields[] = $attrib;
     }
 
     /**
@@ -492,7 +494,7 @@
     public function show()
     {
         $out = '';
-        foreach ($this->fields_arr as $attrib) {
+        foreach ($this->fields as $attrib) {
             $out .= self::tag($this->tagname, array('type' => $this->type) + $attrib);
         }
 
diff --git a/tests/Framework/LdapGeneric.php b/tests/Framework/LdapGeneric.php
index 1bfd12c..dd4db41 100644
--- a/tests/Framework/LdapGeneric.php
+++ b/tests/Framework/LdapGeneric.php
@@ -14,7 +14,7 @@
     function test_class()
     {
         // skip test if Net_LDAP3 does not exist
-        if (!class_exists('Net_LDAP3')) {
+        if (!@class_exists('Net_LDAP3')) {
             $this->markTestSkipped('The Net_LDAP3 package not available.');
         }
 

--
Gitblit v1.9.1