Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/338730 )

Change subject: Inline trivial single use private methods in top level factories
......................................................................

Inline trivial single use private methods in top level factories

This is split from Ie2ee07c to make it much easier to review. All code
touched in this patch here is private (or protected, but there are no
subclasses).

Change-Id: Iec6808cbc1367be0c0f6f5ab2c53e50705f83868
---
M client/includes/WikibaseClient.php
M repo/includes/WikibaseRepo.php
2 files changed, 28 insertions(+), 63 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/30/338730/1

diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index a4957be..815a648 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -839,24 +839,15 @@
         */
        public function getSnakFormatterFactory() {
                if ( $this->snakFormatterFactory === null ) {
-                       $this->snakFormatterFactory = 
$this->newSnakFormatterFactory();
+                       $this->snakFormatterFactory = new 
OutputFormatSnakFormatterFactory(
+                               
$this->dataTypeDefinitions->getSnakFormatterFactoryCallbacks(),
+                               $this->getValueFormatterFactory(),
+                               $this->getPropertyDataTypeLookup(),
+                               $this->getDataTypeFactory()
+                       );
                }
 
                return $this->snakFormatterFactory;
-       }
-
-       /**
-        * @return OutputFormatSnakFormatterFactory
-        */
-       private function newSnakFormatterFactory() {
-               $factory = new OutputFormatSnakFormatterFactory(
-                       
$this->dataTypeDefinitions->getSnakFormatterFactoryCallbacks(),
-                       $this->getValueFormatterFactory(),
-                       $this->getPropertyDataTypeLookup(),
-                       $this->getDataTypeFactory()
-               );
-
-               return $factory;
        }
 
        /**
@@ -867,21 +858,14 @@
         */
        public function getValueFormatterFactory() {
                if ( $this->valueFormatterFactory === null ) {
-                       $this->valueFormatterFactory = 
$this->newValueFormatterFactory();
+                       $this->valueFormatterFactory = new 
OutputFormatValueFormatterFactory(
+                               
$this->dataTypeDefinitions->getFormatterFactoryCallbacks( 
DataTypeDefinitions::PREFIXED_MODE ),
+                               $this->getContentLanguage(),
+                               $this->getLanguageFallbackChainFactory()
+                       );
                }
 
                return $this->valueFormatterFactory;
-       }
-
-       /**
-        * @return OutputFormatValueFormatterFactory
-        */
-       private function newValueFormatterFactory() {
-               return new OutputFormatValueFormatterFactory(
-                       
$this->dataTypeDefinitions->getFormatterFactoryCallbacks( 
DataTypeDefinitions::PREFIXED_MODE ),
-                       $this->getContentLanguage(),
-                       $this->getLanguageFallbackChainFactory()
-               );
        }
 
        /**
@@ -1204,37 +1188,27 @@
         * @return ChangeHandler
         */
        public function getChangeHandler() {
-               return new ChangeHandler(
-                       $this->getAffectedPagesFinder(),
-                       new TitleFactory(),
-                       $this->getWikiPageUpdater(),
-                       $this->getChangeRunCoalescer(),
-                       $this->siteLookup,
-                       $this->settings->getSetting( 'injectRecentChanges' )
-               );
-       }
-
-       /**
-        * @return WikiPageUpdater
-        */
-       private function getWikiPageUpdater() {
-               return new WikiPageUpdater(
+               $pageUpdater = new WikiPageUpdater(
                        JobQueueGroup::singleton(),
                        $this->getRecentChangeFactory(),
                        $this->getStore()->getRecentChangesDuplicateDetector(),
                        MediaWikiServices::getInstance()->getStatsdDataFactory()
                );
-       }
 
-       /**
-        * @return ChangeRunCoalescer
-        */
-       private function getChangeRunCoalescer() {
-               return new ChangeRunCoalescer(
+               $changeListTransformer = new ChangeRunCoalescer(
                        $this->getStore()->getEntityRevisionLookup(),
                        $this->getEntityChangeFactory(),
                        $this->settings->getSetting( 'siteGlobalID' )
                );
+
+               return new ChangeHandler(
+                       $this->getAffectedPagesFinder(),
+                       new TitleFactory(),
+                       $pageUpdater,
+                       $changeListTransformer,
+                       $this->siteLookup,
+                       $this->settings->getSetting( 'injectRecentChanges' )
+               );
        }
 
        /**
diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index 4265f34..f08b00d 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -908,7 +908,12 @@
         */
        public function getSnakFormatterFactory() {
                if ( $this->snakFormatterFactory === null ) {
-                       $this->snakFormatterFactory = 
$this->newSnakFormatterFactory();
+                       $this->snakFormatterFactory = new 
OutputFormatSnakFormatterFactory(
+                               
$this->dataTypeDefinitions->getSnakFormatterFactoryCallbacks(),
+                               $this->getValueFormatterFactory(),
+                               $this->getPropertyDataTypeLookup(),
+                               $this->getDataTypeFactory()
+                       );
                }
 
                return $this->snakFormatterFactory;
@@ -969,20 +974,6 @@
                //@todo: We currently use the local repo concept URI here. This 
should be configurable,
                // to e.g. allow 3rd parties to use Wikidata as their 
vocabulary repo.
                return $this->settings->getSetting( 'conceptBaseUri' );
-       }
-
-       /**
-        * @return OutputFormatSnakFormatterFactory
-        */
-       protected function newSnakFormatterFactory() {
-               $factory = new OutputFormatSnakFormatterFactory(
-                       
$this->dataTypeDefinitions->getSnakFormatterFactoryCallbacks(),
-                       $this->getValueFormatterFactory(),
-                       $this->getPropertyDataTypeLookup(),
-                       $this->getDataTypeFactory()
-               );
-
-               return $factory;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/338730
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec6808cbc1367be0c0f6f5ab2c53e50705f83868
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to