X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcontent%2FTextContent.php;h=d03d61e913b5174b16db68926fe29e09080fea1f;hb=4960dd9b775b4f7aae2e1f1906a1f72b859415df;hp=f66dacd7c126590b27fa74c423a8ef391ebf34ca;hpb=4c6f3d83245520ac7e853dd71cd2a86de51f2fb9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/content/TextContent.php b/includes/content/TextContent.php index f66dacd7c1..d03d61e913 100644 --- a/includes/content/TextContent.php +++ b/includes/content/TextContent.php @@ -33,13 +33,12 @@ * @ingroup Content */ class TextContent extends AbstractContent { - public function __construct( $text, $model_id = CONTENT_MODEL_TEXT ) { parent::__construct( $model_id ); if ( $text === null || $text === false ) { wfWarn( "TextContent constructed with \$text = " . var_export( $text, true ) . "! " - . "This may indicate an error in the caller's scope." ); + . "This may indicate an error in the caller's scope." ); $text = ''; } @@ -74,6 +73,7 @@ class TextContent extends AbstractContent { */ public function getSize() { $text = $this->getNativeData(); + return strlen( $text ); } @@ -107,6 +107,7 @@ class TextContent extends AbstractContent { */ public function getNativeData() { $text = $this->mText; + return $text; } @@ -156,14 +157,14 @@ class TextContent extends AbstractContent { /** * Diff this content object with another content object. * - * @since 1.21diff + * @since 1.21 * * @param $that Content: The other content object to compare this content * object to. * @param $lang Language: The language object to use for text segmentation. * If not given, $wgContentLang is used. * - * @return DiffResult: A diff representing the changes that would have to be + * @return Diff A diff representing the changes that would have to be * made to this content object to make it equal to $that. */ public function diff( Content $that, Language $lang = null ) { @@ -178,13 +179,14 @@ class TextContent extends AbstractContent { } $otext = $this->getNativeData(); - $ntext = $this->getNativeData(); + $ntext = $that->getNativeData(); # Note: Use native PHP diff, external engines don't give us abstract output $ota = explode( "\n", $lang->segmentForDiff( $otext ) ); $nta = explode( "\n", $lang->segmentForDiff( $ntext ) ); $diff = new Diff( $ota, $nta ); + return $diff; } @@ -224,6 +226,7 @@ class TextContent extends AbstractContent { } $po->setText( $html ); + return $po; } @@ -259,8 +262,8 @@ class TextContent extends AbstractContent { * This implementation provides lossless conversion between content models based * on TextContent. * - * @param string $toModel the desired content model, use the CONTENT_MODEL_XXX flags. - * @param string $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is + * @param string $toModel the desired content model, use the CONTENT_MODEL_XXX flags. + * @param string $lossy flag, set to "lossy" to allow lossy conversion. If lossy conversion is * not allowed, full round-trip conversion is expected to work without losing information. * * @return Content|bool A content object with the content model $toModel, or false if