Drop unused FormatMetadata::flattenArray method
authorThiemo Mättig <thiemo.maettig@wikimedia.de>
Mon, 20 Apr 2015 13:41:28 +0000 (15:41 +0200)
committerThiemo Mättig <thiemo.maettig@wikimedia.de>
Mon, 20 Apr 2015 13:41:28 +0000 (15:41 +0200)
This is a pure helper method, not closely related to this class, and
currently unused.

Change-Id: I278058677ad407aae8cd2ba8fe34c12b1e86033f

includes/media/FormatMetadata.php
tests/phpunit/includes/media/FormatMetadataTest.php

index 7246072..0c6b6c7 100644 (file)
@@ -1003,28 +1003,6 @@ class FormatMetadata extends ContextSource {
                return $obj->flattenArrayReal( $vals, $type, $noHtml );
        }
 
-       /**
-        * Flatten an array, using the user language for any messages.
-        *
-        * @param array $vals Array of values
-        * @param string $type Type of array (either lang, ul, ol).
-        *   lang = language assoc array with keys being the lang code
-        *   ul = unordered list, ol = ordered list
-        *   type can also come from the '_type' member of $vals.
-        * @param bool $noHtml If to avoid returning anything resembling HTML.
-        *   (Ugly hack for backwards compatibility with old MediaWiki).
-        * @param bool|IContextSource $context
-        * @return string Single value (in wiki-syntax).
-        */
-       public static function flattenArray( $vals, $type = 'ul', $noHtml = false, $context = false ) {
-               $obj = new FormatMetadata;
-               if ( $context ) {
-                       $obj->setContext( $context );
-               }
-
-               return $obj->flattenArrayReal( $vals, $type, $noHtml );
-       }
-
        /**
         * A function to collapse multivalued tags into a single value.
         * This turns an array of (for example) authors into a bulleted list.
index 54758f9..b666c83 100644 (file)
@@ -36,39 +36,6 @@ class FormatMetadataTest extends MediaWikiMediaTestCase {
                        'File with invalid date metadata (bug 29471)' );
        }
 
-       /**
-        * @param string $filename
-        * @param int $expected Total image area
-        * @dataProvider provideFlattenArray
-        * @covers FormatMetadata::flattenArray
-        */
-       public function testFlattenArray( $vals, $type, $noHtml, $ctx, $expected ) {
-               $actual = FormatMetadata::flattenArray( $vals, $type, $noHtml, $ctx );
-               $this->assertEquals( $expected, $actual );
-       }
-
-       public static function provideFlattenArray() {
-               return array(
-                       array(
-                               array( 1, 2, 3 ), 'ul', false, false,
-                               "<ul><li>1</li>\n<li>2</li>\n<li>3</li></ul>",
-                       ),
-                       array(
-                               array( 1, 2, 3 ), 'ol', false, false,
-                               "<ol><li>1</li>\n<li>2</li>\n<li>3</li></ol>",
-                       ),
-                       array(
-                               array( 1, 2, 3 ), 'ul', true, false,
-                               "\n*1\n*2\n*3",
-                       ),
-                       array(
-                               array( 1, 2, 3 ), 'ol', true, false,
-                               "\n#1\n#2\n#3",
-                       ),
-                       // TODO: more test cases
-               );
-       }
-
        /**
         * @param mixed $input
         * @param mixed $output