Moved $wgQueryPages stuff out of the global scope and into a function
[lhc/web/wiklou.git] / includes / diff / TableDiffFormatter.php
index 0ce17df..ac8f758 100644 (file)
@@ -31,6 +31,7 @@
  * @ingroup DifferenceEngine
  */
 class TableDiffFormatter extends DiffFormatter {
+
        function __construct() {
                $this->leadingContextLines = 2;
                $this->trailingContextLines = 2;
@@ -38,31 +39,37 @@ class TableDiffFormatter extends DiffFormatter {
 
        /**
         * @static
-        * @param $msg
+        * @param string $msg
+        *
         * @return mixed
         */
        public static function escapeWhiteSpace( $msg ) {
                $msg = preg_replace( '/^ /m', '  ', $msg );
                $msg = preg_replace( '/ $/m', '  ', $msg );
                $msg = preg_replace( '/  /', '  ', $msg );
+
                return $msg;
        }
 
        /**
-        * @param $xbeg
-        * @param $xlen
-        * @param $ybeg
-        * @param $ylen
+        * @param int $xbeg
+        * @param int $xlen
+        * @param int $ybeg
+        * @param int $ylen
+        *
         * @return string
         */
        protected function blockHeader( $xbeg, $xlen, $ybeg, $ylen ) {
                $r = '<tr><td colspan="2" class="diff-lineno"><!--LINE ' . $xbeg . "--></td>\n" .
                        '<td colspan="2" class="diff-lineno"><!--LINE ' . $ybeg . "--></td></tr>\n";
+
                return $r;
        }
 
        /**
-        * @param $header
+        * Writes the header to the output buffer.
+        *
+        * @param string $header
         */
        protected function startBlock( $header ) {
                echo $header;
@@ -71,12 +78,19 @@ class TableDiffFormatter extends DiffFormatter {
        protected function endBlock() {
        }
 
+       /**
+        * @param string[] $lines
+        * @param string $prefix
+        * @param string $color
+        */
        protected function lines( $lines, $prefix = ' ', $color = 'white' ) {
        }
 
        /**
         * HTML-escape parameter before calling this
-        * @param $line
+        *
+        * @param string $line
+        *
         * @return string
         */
        protected function addedLine( $line ) {
@@ -85,7 +99,9 @@ class TableDiffFormatter extends DiffFormatter {
 
        /**
         * HTML-escape parameter before calling this
-        * @param $line
+        *
+        * @param string $line
+        *
         * @return string
         */
        protected function deletedLine( $line ) {
@@ -94,7 +110,9 @@ class TableDiffFormatter extends DiffFormatter {
 
        /**
         * HTML-escape parameter before calling this
-        * @param $line
+        *
+        * @param string $line
+        *
         * @return string
         */
        protected function contextLine( $line ) {
@@ -102,9 +120,10 @@ class TableDiffFormatter extends DiffFormatter {
        }
 
        /**
-        * @param $marker
-        * @param $class
-        * @param $line
+        * @param string $marker
+        * @param string $class Unused
+        * @param string $line
+        *
         * @return string
         */
        protected function wrapLine( $marker, $class, $line ) {
@@ -112,6 +131,7 @@ class TableDiffFormatter extends DiffFormatter {
                        // The <div> wrapper is needed for 'overflow: auto' style to scroll properly
                        $line = Xml::tags( 'div', null, $this->escapeWhiteSpace( $line ) );
                }
+
                return "<td class='diff-marker'>$marker</td><td class='$class'>$line</td>";
        }
 
@@ -123,7 +143,9 @@ class TableDiffFormatter extends DiffFormatter {
        }
 
        /**
-        * @param $lines array
+        * Writes all lines to the output buffer, each enclosed in <tr>.
+        *
+        * @param string[] $lines
         */
        protected function added( $lines ) {
                foreach ( $lines as $line ) {
@@ -134,7 +156,9 @@ class TableDiffFormatter extends DiffFormatter {
        }
 
        /**
-        * @param $lines
+        * Writes all lines to the output buffer, each enclosed in <tr>.
+        *
+        * @param string[] $lines
         */
        protected function deleted( $lines ) {
                foreach ( $lines as $line ) {
@@ -145,7 +169,9 @@ class TableDiffFormatter extends DiffFormatter {
        }
 
        /**
-        * @param $lines
+        * Writes all lines to the output buffer, each enclosed in <tr>.
+        *
+        * @param string[] $lines
         */
        protected function context( $lines ) {
                foreach ( $lines as $line ) {
@@ -156,8 +182,10 @@ class TableDiffFormatter extends DiffFormatter {
        }
 
        /**
-        * @param $orig
-        * @param $closing
+        * Writes the two sets of lines to the output buffer, each enclosed in <tr>.
+        *
+        * @param string[] $orig
+        * @param string[] $closing
         */
        protected function changed( $orig, $closing ) {
                wfProfileIn( __METHOD__ );
@@ -174,10 +202,11 @@ class TableDiffFormatter extends DiffFormatter {
                        echo '<tr>' . $this->deletedLine( $line ) .
                                $this->addedLine( $aline ) . "</tr>\n";
                }
-               foreach ( $add as $line ) {     # If any leftovers
+               foreach ( $add as $line ) { # If any leftovers
                        echo '<tr>' . $this->emptyLine() .
                                $this->addedLine( $line ) . "</tr>\n";
                }
                wfProfileOut( __METHOD__ );
        }
+
 }