From 1ad559912ca73e2ba32607a756324d9d38f47cf3 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 17 Apr 2012 18:08:23 +0200 Subject: [PATCH] renamed emptyContent to makeEmptyContent --- includes/ContentHandler.php | 15 +++++---------- includes/EditPage.php | 10 +++++----- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/includes/ContentHandler.php b/includes/ContentHandler.php index 6a1497817b..d03bdcaa46 100644 --- a/includes/ContentHandler.php +++ b/includes/ContentHandler.php @@ -256,8 +256,6 @@ abstract class ContentHandler { /** * Serializes Content object of the type supported by this ContentHandler. * - * @FIXME: bad method name: suggests it serializes a ContentHandler, while in fact it serializes a Content object - * * @abstract * @param Content $content the Content object to serialize * @param null $format the desired serialization format @@ -268,8 +266,6 @@ abstract class ContentHandler { /** * Unserializes a Content object of the type supported by this ContentHandler. * - * @FIXME: bad method name: suggests it unserializes a ContentHandler, while in fact it unserializes a Content object - * * @abstract * @param $blob String serialized form of the content * @param null $format the format used for serialization @@ -280,9 +276,8 @@ abstract class ContentHandler { /** * Creates an empty Content object of the type supported by this ContentHandler. * - * @FIXME: bad method name: suggests it empties the content of an instance rather then creating a new empty one */ - public abstract function emptyContent(); + public abstract function makeEmptyContent(); /** * Returns the model name that identifies the content model this ContentHandler can handle. @@ -680,7 +675,7 @@ abstract class TextContentHandler extends ContentHandler { } if ( !$result ) { - return $this->emptyContent(); + return $this->makeEmptyContent(); } $mergedContent = $this->unserializeContent( $result, $format ); @@ -701,7 +696,7 @@ class WikitextContentHandler extends TextContentHandler { return new WikitextContent( $text ); } - public function emptyContent() { + public function makeEmptyContent() { return new WikitextContent( '' ); } @@ -720,7 +715,7 @@ class JavaScriptContentHandler extends TextContentHandler { return new JavaScriptContent( $text ); } - public function emptyContent() { + public function makeEmptyContent() { return new JavaScriptContent( '' ); } } @@ -735,7 +730,7 @@ class CssContentHandler extends TextContentHandler { return new CssContent( $text ); } - public function emptyContent() { + public function makeEmptyContent() { return new CssContent( '' ); } diff --git a/includes/EditPage.php b/includes/EditPage.php index d1ba6744ac..2e202ed1d5 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -917,7 +917,7 @@ class EditPage { if ( !$this->content_model ) $this->content_model = $this->getTitle()->getContentModelName(); $handler = ContentHandler::getForModelName( $this->content_model ); - return $handler->emptyContent(); + return $handler->makeEmptyContent(); } $content = $revision->getContent(); return $content; @@ -939,7 +939,7 @@ class EditPage { if ( !$this->content_model ) $this->content_model = $this->getTitle()->getContentModelName(); $handler = ContentHandler::getForModelName( $this->content_model ); - return $handler->emptyContent(); + return $handler->makeEmptyContent(); } else { #FIXME: nasty side-effect! $this->content_model = $rev->getContentModelName(); @@ -1000,13 +1000,13 @@ class EditPage { $handler = ContentHandler::getForTitle( $this->getTitle() ); if ( $preload === '' ) { - return $handler->emptyContent(); + return $handler->makeEmptyContent(); } $title = Title::newFromText( $preload ); # Check for existence to avoid getting MediaWiki:Noarticletext if ( $title === null || !$title->exists() || !$title->userCan( 'read' ) ) { - return $handler->emptyContent(); + return $handler->makeEmptyContent(); } $page = WikiPage::factory( $title ); @@ -1014,7 +1014,7 @@ class EditPage { $title = $page->getRedirectTarget(); # Same as before if ( $title === null || !$title->exists() || !$title->userCan( 'read' ) ) { - return $handler->emptyContent(); + return $handler->makeEmptyContent(); } $page = WikiPage::factory( $title ); } -- 2.20.1