当前位置: 首页>>代码示例>>PHP>>正文


PHP Item::getSiteLinkList方法代码示例

本文整理汇总了PHP中Wikibase\DataModel\Entity\Item::getSiteLinkList方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getSiteLinkList方法的具体用法?PHP Item::getSiteLinkList怎么用?PHP Item::getSiteLinkList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wikibase\DataModel\Entity\Item的用法示例。


在下文中一共展示了Item::getSiteLinkList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addIdLinkForLanguage

 private function addIdLinkForLanguage($languageCode)
 {
     $links = $this->item->getSiteLinkList();
     if ($links->hasLinkWithSiteId($languageCode . 'wiki')) {
         $this->simpleItem->ids[$languageCode . '_wikipedia'] = $links->getBySiteId($languageCode . 'wiki')->getPageName();
     }
 }
开发者ID:queryr,项目名称:serialization,代码行数:7,代码来源:SimpleItemBuilder.php

示例2: getSiteLinkLookup

 /**
  * @param ItemId[] $links
  *
  * @return SiteLinkLookup
  */
 private function getSiteLinkLookup(array $links)
 {
     $siteLinkLookup = new HashSiteLinkStore();
     foreach ($links as $pageId => $itemId) {
         $pageName = self::PAGE_NAME_PREFIX . $pageId;
         $item = new Item($itemId);
         $item->getSiteLinkList()->addNewSiteLink('testwiki', $pageName);
         $item->getSiteLinkList()->addNewSiteLink('badwiki', $pageName);
         $item->getSiteLinkList()->addNewSiteLink('sadwiki', 'Other stuff');
         $siteLinkLookup->saveLinksOfItem($item);
     }
     return $siteLinkLookup;
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:18,代码来源:SiteLinkUsageLookupTest.php

示例3: addWikipediaHtmlUrl

 private function addWikipediaHtmlUrl()
 {
     $wikiId = $this->getWikiId($this->languageCode);
     if ($this->item->getSiteLinkList()->hasLinkWithSiteId($wikiId)) {
         $this->simpleItem->wikipediaHtmlUrl = $this->urlBuilder->getSiteLinkBasedRerirectUrl($wikiId, $this->item->getId());
     }
 }
开发者ID:JeroenDeDauw,项目名称:QueryrAPI,代码行数:7,代码来源:SimpleItemBuilder.php

示例4: getEntityRevisionLookup

 /**
  * @return EntityRevisionLookup
  */
 private function getEntityRevisionLookup()
 {
     $repo = new MockRepository();
     $offsets = array('Q1' => 1100, 'Q2' => 1200);
     foreach ($offsets as $qid => $offset) {
         // entity 1, revision 1111
         $entity1 = new Item(new ItemId($qid));
         $entity1->setLabel('en', 'ORIGINAL');
         $entity1->getSiteLinkList()->addNewSiteLink('enwiki', 'Original');
         $repo->putEntity($entity1, $offset + 11);
         // entity 1, revision 1112
         $entity1->setLabel('de', 'HINZUGEFÜGT');
         $repo->putEntity($entity1, $offset + 12);
         // entity 1, revision 1113
         $entity1->setLabel('nl', 'Addiert');
         $repo->putEntity($entity1, $offset + 13);
         // entity 1, revision 1114
         $entity1->getSiteLinkList()->addNewSiteLink('dewiki', 'Testen');
         $repo->putEntity($entity1, $offset + 14);
         // entity 1, revision 1117
         $entity1->getSiteLinkList()->setSiteLink(new SiteLink('enwiki', 'Spam', array(new ItemId('Q12345'))));
         $repo->putEntity($entity1, $offset + 17);
         // entity 1, revision 1118
         $entity1->getSiteLinkList()->setSiteLink(new SiteLink('enwiki', 'Spam', array(new ItemId('Q54321'))));
         $repo->putEntity($entity1, $offset + 18);
     }
     return $repo;
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:31,代码来源:ChangeRunCoalescerTest.php

示例5: getSiteLink

 /**
  * Get a SiteLink for a specific item and site
  *
  * @param Item $item
  * @param string $globalId
  *
  * @return SiteLink|null
  */
 private function getSiteLink($item, $globalId)
 {
     try {
         return $item->getSiteLinkList()->getBySiteId($globalId);
     } catch (OutOfBoundsException $e) {
         return null;
     }
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:16,代码来源:UpdateRepoOnMoveJob.php

示例6: patchItem

 private function patchItem(Item $item, EntityDiff $patch)
 {
     $this->fingerprintPatcher->patchFingerprint($item->getFingerprint(), $patch);
     if ($patch instanceof ItemDiff) {
         $item->setSiteLinkList($this->siteLinkListPatcher->getPatchedSiteLinkList($item->getSiteLinkList(), $patch->getSiteLinkDiff()));
     }
     $item->setStatements($this->statementListPatcher->getPatchedStatementList($item->getStatements(), $patch->getClaimsDiff()));
 }
开发者ID:SRMSE,项目名称:cron-wikidata,代码行数:8,代码来源:ItemPatcher.php

示例7: testGivenUntrimmedPageName_generateDoesNotTrim

 public function testGivenUntrimmedPageName_generateDoesNotTrim()
 {
     $item = new Item();
     $item->getFingerprint()->setLabel('en', ' untrimmed label ');
     $item->getSiteLinkList()->addNewSiteLink('enwiki', ' untrimmed pageName ');
     $generator = new ItemSearchTextGenerator();
     $text = $generator->generate($item);
     $this->assertSame(" untrimmed label \n untrimmed pageName ", $text);
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:9,代码来源:ItemSearchTextGeneratorTest.php

示例8: testGivenEmptyDiff_itemIsReturnedAsIs

 public function testGivenEmptyDiff_itemIsReturnedAsIs()
 {
     $item = new Item();
     $item->getFingerprint()->setLabel('en', 'foo');
     $item->getSiteLinkList()->addNewSiteLink('enwiki', 'bar');
     $patchedItem = $this->getPatchedItem($item, new ItemDiff());
     $this->assertInstanceOf('Wikibase\\DataModel\\Entity\\Item', $patchedItem);
     $this->assertTrue($item->equals($patchedItem));
 }
开发者ID:SRMSE,项目名称:cron-wikidata,代码行数:9,代码来源:ItemPatcherTest.php

示例9: generate

 /**
  * @param Item $item
  *
  * @return string
  */
 public function generate(Item $item)
 {
     $fingerprintGenerator = new FingerprintSearchTextGenerator();
     $text = $fingerprintGenerator->generate($item->getFingerprint());
     foreach ($item->getSiteLinkList()->toArray() as $siteLink) {
         $text .= "\n" . $siteLink->getPageName();
     }
     return trim($text, "\n");
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:14,代码来源:ItemSearchTextGenerator.php

示例10: testLinkSitelinks

 /**
  * @depends testCreateItem
  * @depends testSetSitelink
  */
 public function testLinkSitelinks()
 {
     $factory = $factory = TestEnvironment::newDefault()->getFactory();
     $enwikiLondon = new SiteLink('enwiki', 'London');
     $dewikiBerlin = new Sitelink('dewiki', 'Berlin');
     $r = $factory->newSiteLinkLinker()->link($enwikiLondon, $dewikiBerlin);
     $this->assertTrue($r);
     self::$localItem->getSiteLinkList()->addSiteLink($dewikiBerlin);
 }
开发者ID:hakanozdemir,项目名称:wikibase-api,代码行数:13,代码来源:IntegrationTest.php

示例11: testConstructionDiffContainsAddOperations

 public function testConstructionDiffContainsAddOperations()
 {
     $item = new Item();
     $item->getFingerprint()->setLabel('en', 'foo');
     $item->getSiteLinkList()->addNewSiteLink('bar', 'baz');
     $differ = new ItemDiffer();
     $diff = $differ->getConstructionDiff($item);
     $this->assertEquals(new Diff(array('en' => new DiffOpAdd('foo'))), $diff->getLabelsDiff());
     $this->assertEquals(new Diff(array('bar' => new Diff(array('name' => new DiffOpAdd('baz'))))), $diff->getSiteLinkDiff());
 }
开发者ID:SRMSE,项目名称:cron-wikidata,代码行数:10,代码来源:ItemDifferTest.php

示例12: generateSitelinksChangeOps

 private function generateSitelinksChangeOps()
 {
     foreach ($this->fromItem->getSiteLinkList()->toArray() as $fromSiteLink) {
         $siteId = $fromSiteLink->getSiteId();
         if (!$this->toItem->getSiteLinkList()->hasLinkWithSiteId($siteId)) {
             $this->generateSitelinksChangeOpsWithNoConflict($fromSiteLink);
         } else {
             $this->generateSitelinksChangeOpsWithConflict($fromSiteLink);
         }
     }
 }
开发者ID:TU-Berlin,项目名称:WikidataMath,代码行数:11,代码来源:ChangeOpsMerge.php

示例13: getLinksInDiffFormat

 private function getLinksInDiffFormat(Item $item)
 {
     $links = array();
     /**
      * @var SiteLink $siteLink
      */
     foreach ($item->getSiteLinkList() as $siteLink) {
         $links[$siteLink->getSiteId()] = array('name' => $siteLink->getPageName(), 'badges' => array_map(function (ItemId $id) {
             return $id->getSerialization();
         }, $siteLink->getBadges()));
     }
     return $links;
 }
开发者ID:SRMSE,项目名称:cron-wikidata,代码行数:13,代码来源:ItemDiffer.php

示例14: makeEntity

 /**
  * @param EntityId $id
  *
  * @throws InvalidArgumentException
  * @return Item|Property
  */
 protected function makeEntity(EntityId $id)
 {
     if ($id instanceof ItemId) {
         $entity = new Item($id);
         $entity->getSiteLinkList()->addNewSiteLink('test', 'Foo');
     } elseif ($id instanceof PropertyId) {
         $entity = new Property($id, null, 'wibblywobbly');
     } else {
         throw new InvalidArgumentException('Unsupported entity type ' . $id->getEntityType());
     }
     $entity->setLabel('en', 'label:' . $id->getSerialization());
     return $entity;
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:19,代码来源:JsonDumpGeneratorTest.php

示例15: testValidateEntity_conflict

 public function testValidateEntity_conflict()
 {
     $badEntity = new Item(new ItemId('Q7'));
     $badEntity->getSiteLinkList()->addNewSiteLink('testwiki', 'DUPE');
     $siteLinkConflictLookup = $this->getMockSiteLinkConflictLookup();
     $validator = new SiteLinkUniquenessValidator($siteLinkConflictLookup);
     $result = $validator->validateEntity($badEntity);
     $this->assertFalse($result->isValid(), 'isValid');
     $errors = $result->getErrors();
     $this->assertEquals('sitelink-conflict', $errors[0]->getCode());
     $this->assertInstanceOf('Wikibase\\Repo\\Validators\\UniquenessViolation', $errors[0]);
     //NOTE: ChangeOpTestMockProvider::getSiteLinkConflictsForItem() uses 'Q666' as
     //      the conflicting item for all site links with the name 'DUPE'.
     $this->assertEquals('Q666', $errors[0]->getConflictingEntity());
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:15,代码来源:SiteLinkUniquenessValidatorTest.php


注:本文中的Wikibase\DataModel\Entity\Item::getSiteLinkList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。