Fix issues identified by SpaceBeforeSingleLineComment sniff
[lhc/web/wiklou.git] / languages / LanguageConverter.php
index a6b687c..41d282b 100644 (file)
@@ -502,13 +502,9 @@ class LanguageConverter {
                        }
 
                        if ( $action == 'add' ) {
+                               // More efficient than array_merge(), about 2.5 times.
                                foreach ( $pair as $from => $to ) {
-                                       // to ensure that $from and $to not be left blank
-                                       // so $this->translate() could always return a string
-                                       if ( $from || $to ) {
-                                               // more efficient than array_merge(), about 2.5 times.
-                                               $this->mTables[$variant]->setPair( $from, $to );
-                                       }
+                                       $this->mTables[$variant]->setPair( $from, $to );
                                }
                        } elseif ( $action == 'remove' ) {
                                $this->mTables[$variant]->removeArray( $pair );
@@ -996,7 +992,7 @@ class LanguageConverter {
                if ( $recursive ) {
                        foreach ( $sublinks as $link ) {
                                $s = $this->parseCachedTable( $code, $link, $recursive );
-                               $ret = array_merge( $ret, $s );
+                               $ret = $s + $ret;
                        }
                }
 
@@ -1096,13 +1092,13 @@ class LanguageConverter {
                        // text should be splited by ";" only if a valid variant
                        // name exist after the markup, for example:
                        //  -{zh-hans:<span style="font-size:120%;">xxx</span>;zh-hant:\
-                       //      <span style="font-size:120%;">yyy</span>;}-
+                       //      <span style="font-size:120%;">yyy</span>;}-
                        // we should split it as:
                        //  array(
-                       //        [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
-                       //        [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
-                       //        [2] => ''
-                       //       )
+                       //        [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
+                       //        [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
+                       //        [2] => ''
+                       //       )
                        $pat = '/;\s*(?=';
                        foreach ( $this->mVariants as $variant ) {
                                // zh-hans:xxx;zh-hant:yyy