jenkins-bot has submitted this change and it was merged.

Change subject: Add getEntityIdFormatter to top level factory.
......................................................................


Add getEntityIdFormatter to top level factory.

Change-Id: I6a0caf0cdbaee73dfca2e03ded63dc01e1cbaa2e
---
M repo/includes/WikibaseRepo.php
M repo/tests/phpunit/includes/WikibaseRepoTest.php
2 files changed, 24 insertions(+), 0 deletions(-)

Approvals:
  Tobias Gritschacher: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index a68149f..3e130f3 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -247,6 +247,25 @@
        /**
         * @since 0.4
         *
+        * @return EntityIdFormatter
+        */
+       public function getEntityIdFormatter() {
+               $prefixMap = array();
+
+               foreach ( $this->settings->getSetting( 'entityPrefixes' ) as 
$prefix => $entityType ) {
+                       $prefixMap[$entityType] = $prefix;
+               }
+
+               $options = new FormatterOptions( array(
+                       EntityIdFormatter::OPT_PREFIX_MAP => $prefixMap
+               ) );
+
+               return new EntityIdFormatter( $options );
+       }
+
+       /**
+        * @since 0.4
+        *
         * @return LanguageFallbackChainFactory
         */
        public function getLanguageFallbackChainFactory() {
diff --git a/repo/tests/phpunit/includes/WikibaseRepoTest.php 
b/repo/tests/phpunit/includes/WikibaseRepoTest.php
index 04ed56e..e081b3a 100644
--- a/repo/tests/phpunit/includes/WikibaseRepoTest.php
+++ b/repo/tests/phpunit/includes/WikibaseRepoTest.php
@@ -60,6 +60,11 @@
                $this->assertInstanceOf( 'Wikibase\Lib\EntityIdParser', 
$returnValue );
        }
 
+       public function testGetEntityIdFormatterReturnType() {
+               $returnValue = 
$this->getDefaultInstance()->getEntityIdFormatter();
+               $this->assertInstanceOf( 'Wikibase\Lib\EntityIdFormatter', 
$returnValue );
+       }
+
        public static function provideGetRdfBaseURI() {
                return array(
                        array ( 'http://acme.test', 'http://acme.test/entity/' 
),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6a0caf0cdbaee73dfca2e03ded63dc01e1cbaa2e
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Anja Jentzsch <[email protected]>
Gerrit-Reviewer: Ataherivand <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Daniel Werner <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>
Gerrit-Reviewer: Henning Snater <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jens Ohlig <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: John Erling Blad <[email protected]>
Gerrit-Reviewer: Liangent <[email protected]>
Gerrit-Reviewer: Lydia Pintscher <[email protected]>
Gerrit-Reviewer: Markus Kroetzsch <[email protected]>
Gerrit-Reviewer: Nikola Smolenski <[email protected]>
Gerrit-Reviewer: Nilesh <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to