renamed emptyContent to makeEmptyContent
authordaniel <daniel.kinzler@wikimedia.de>
Tue, 17 Apr 2012 16:08:23 +0000 (18:08 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Tue, 17 Apr 2012 16:08:23 +0000 (18:08 +0200)
includes/ContentHandler.php
includes/EditPage.php

index 6a14978..d03bdca 100644 (file)
@@ -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( '' );
     }
 
index d1ba674..2e202ed 100644 (file)
@@ -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 );
         }