jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/334873 )

Change subject: Inject FormatSnakValue dependencies
......................................................................


Inject FormatSnakValue dependencies

Bug: T156579
Change-Id: If617250c4052e12f86efb74ba9e979925ddbb8fd
---
M repo/Wikibase.php
M repo/includes/Api/FormatSnakValue.php
2 files changed, 27 insertions(+), 19 deletions(-)

Approvals:
  WMDE-leszek: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/Wikibase.php b/repo/Wikibase.php
index 08c4182..56876ef 100644
--- a/repo/Wikibase.php
+++ b/repo/Wikibase.php
@@ -238,7 +238,22 @@
        $wgAPIModules['wbremovequalifiers'] = 
Wikibase\Repo\Api\RemoveQualifiers::class;
        $wgAPIModules['wbsetqualifier'] = Wikibase\Repo\Api\SetQualifier::class;
        $wgAPIModules['wbmergeitems'] = Wikibase\Repo\Api\MergeItems::class;
-       $wgAPIModules['wbformatvalue'] = 
Wikibase\Repo\Api\FormatSnakValue::class;
+       $wgAPIModules['wbformatvalue'] = [
+               'class' => Wikibase\Repo\Api\FormatSnakValue::class,
+               'factory' => function( ApiMain $mainModule, $moduleName ) {
+                       $wikibaseRepo = 
Wikibase\Repo\WikibaseRepo::getDefaultInstance();
+                       $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( 
$mainModule->getContext() );
+
+                       return new Wikibase\Repo\Api\FormatSnakValue(
+                               $mainModule,
+                               $moduleName,
+                               $wikibaseRepo->getValueFormatterFactory(),
+                               $wikibaseRepo->getSnakFormatterFactory(),
+                               $wikibaseRepo->getDataValueFactory(),
+                               $apiHelperFactory->getErrorReporter( 
$mainModule )
+                       );
+               }
+       ];
        $wgAPIModules['wbparsevalue'] = [
                'class' => Wikibase\Repo\Api\ParseValue::class,
                'factory' => function( ApiMain $mainModule, $moduleName ) {
diff --git a/repo/includes/Api/FormatSnakValue.php 
b/repo/includes/Api/FormatSnakValue.php
index 8402e09..6b8fac2 100644
--- a/repo/includes/Api/FormatSnakValue.php
+++ b/repo/includes/Api/FormatSnakValue.php
@@ -52,32 +52,25 @@
        private $errorReporter;
 
        /**
+        * @see ApiBase::__construct
+        *
         * @param ApiMain $mainModule
         * @param string $moduleName
-        * @param string $modulePrefix
-        *
-        * @see ApiBase::__construct
+        * @param OutputFormatValueFormatterFactory $valueFormatterFactory
+        * @param OutputFormatSnakFormatterFactory $snakFormatterFactory
+        * @param DataValueFactory $dataValueFactory
+        * @param ApiErrorReporter $apiErrorReporter
         */
-       public function __construct( ApiMain $mainModule, $moduleName, 
$modulePrefix = '' ) {
-               parent::__construct( $mainModule, $moduleName, $modulePrefix );
-
-               $wikibaseRepo = WikibaseRepo::getDefaultInstance();
-               $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( 
$this->getContext() );
-
-               $this->setServices(
-                       $wikibaseRepo->getValueFormatterFactory(),
-                       $wikibaseRepo->getSnakFormatterFactory(),
-                       $wikibaseRepo->getDataValueFactory(),
-                       $apiHelperFactory->getErrorReporter( $this )
-               );
-       }
-
-       public function setServices(
+       public function __construct(
+               ApiMain $mainModule,
+               $moduleName,
                OutputFormatValueFormatterFactory $valueFormatterFactory,
                OutputFormatSnakFormatterFactory $snakFormatterFactory,
                DataValueFactory $dataValueFactory,
                ApiErrorReporter $apiErrorReporter
        ) {
+               parent::__construct( $mainModule, $moduleName );
+
                $this->valueFormatterFactory = $valueFormatterFactory;
                $this->snakFormatterFactory = $snakFormatterFactory;
                $this->dataValueFactory = $dataValueFactory;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If617250c4052e12f86efb74ba9e979925ddbb8fd
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: WMDE-leszek <leszek.mani...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to