本文整理汇总了PHP中Wikibase\DataModel\Entity\Item::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::setDescription方法的具体用法?PHP Item::setDescription怎么用?PHP Item::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikibase\DataModel\Entity\Item
的用法示例。
在下文中一共展示了Item::setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getKnownEntities
/**
* @return EntityDocument[]
*/
protected function getKnownEntities()
{
$q1 = new Item(new ItemId('Q1'));
$q1->setLabel('en', 'label:Q1/en');
$q1->setLabel('de', 'label:Q1/de');
$q1->setDescription('en', 'description:Q1/en');
$q1->setDescription('de', 'description:Q1/de');
$q1->setAliases('en', array('alias:Q1/en#1'));
$q1->setAliases('de', array('alias:Q1/de#1', 'alias:Q1/de#2'));
$q2 = new Item(new ItemId('Q2'));
$q2->setLabel('en', 'label:Q2/en');
$q2->setLabel('de', 'label:Q2/de');
$q2->setAliases('en', array('alias:Q2/en#1'));
$q2->setAliases('de', array('alias:Q2/de#1', 'alias:Q2/de#2'));
$p2 = Property::newFromType('string');
$p2->setId(new PropertyId('P2'));
$p2->setLabel('en', 'label:P2/en');
$p2->setLabel('de', 'label:P2/de');
$p2->setDescription('en', 'description:P2/en');
$p2->setDescription('de', 'description:P2/de');
$p2->setAliases('en', array('alias:P2/en#1'));
$p2->setAliases('de', array('alias:P2/de#1', 'alias:P2/de#2'));
$p3 = Property::newFromType('string');
$p3->setId(new PropertyId('P3'));
$p3->setLabel('en', 'label:P3/en');
$p3->setLabel('de', 'label:P3/de');
$p3->setDescription('en', 'description:P3/en');
$p3->setDescription('de', 'description:P3/de');
return array($q1, $q2, $p2, $p3);
}
示例2: itemProvider
public function itemProvider()
{
$emptyItem = new Item(new ItemId('Q1'));
$item = new Item(new ItemId('Q11'));
$item->setDescription('en', 'ohi there');
$item->setLabel('de', 'o_O');
$item->setAliases('nl', array('foo', 'bar'));
$item2 = new Item(new ItemId('Q12'));
$item2->setLabel('de', 'o_O');
$item2->setLabel('en', 'O_o');
$item2->setAliases('nl', array('daaaah'));
$redirect = new EntityRedirect(new ItemId('Q11'), new ItemId('Q21'));
$redirect2 = new EntityRedirect(new ItemId('Q11'), new ItemId('Q22'));
$insTags = array('has <td>label / de</td>' => array('tag' => 'td', 'content' => 'label / de'), 'has <ins>foo</ins>' => array('tag' => 'ins', 'content' => 'foo'), 'has <td>aliases / nl / 0</td>' => array('tag' => 'td', 'content' => 'aliases / nl / 0'), 'has <ins>bar</ins>' => array('tag' => 'ins', 'content' => 'bar'), 'has <td>description / en</td>' => array('tag' => 'td', 'content' => 'description / en'), 'has <ins>ohi there</ins>' => array('tag' => 'ins', 'content' => 'ohi there'));
$delTags = array('has <td>label / de</td>' => array('tag' => 'td', 'content' => 'label / de'), 'has <del>foo</del>' => array('tag' => 'del', 'content' => 'foo'), 'has <td>aliases / nl / 0</td>' => array('tag' => 'td', 'content' => 'aliases / nl / 0'), 'has <del>bar</del>' => array('tag' => 'del', 'content' => 'bar'), 'has <td>description / en</td>' => array('tag' => 'td', 'content' => 'description / en'), 'has <del>ohi there</del>' => array('tag' => 'del', 'content' => 'ohi there'));
$changeTags = array('has <td>label / en</td>' => array('tag' => 'td', 'content' => 'label / en'), 'has <ins>O_o</ins>' => array('tag' => 'ins', 'content' => 'O_o'), 'has <td>aliases / nl / 0</td>' => array('tag' => 'td', 'content' => 'aliases / nl / 0'), 'has <ins>daaaah</ins>' => array('tag' => 'ins', 'content' => 'daaaah'), 'has <td>aliases / nl / 1</td>' => array('tag' => 'td', 'content' => 'aliases / nl / 1'), 'has <del>foo</del>' => array('tag' => 'del', 'content' => 'foo'), 'has <td>aliases / nl / 2</td>' => array('tag' => 'td', 'content' => 'aliases / nl / 2'), 'has <del>bar</del>' => array('tag' => 'del', 'content' => 'bar'), 'has <td>description / en</td>' => array('tag' => 'td', 'content' => 'description / en'), 'has <del>ohi there</del>' => array('tag' => 'del', 'content' => 'ohi there'));
$fromRedirTags = array('has <td>label / de</td>' => array('tag' => 'td', 'content' => 'label / de'), 'has <ins>foo</ins>' => array('tag' => 'ins', 'content' => 'foo'), 'has <td>redirect</td>' => array('tag' => 'td', 'content' => 'redirect'), 'has <del>Q21</del>' => array('tag' => 'del', 'content' => 'Q21'));
$toRedirTags = array('has <td>label / de</td>' => array('tag' => 'td', 'content' => 'label / de'), 'has <del>foo</del>' => array('tag' => 'del', 'content' => 'foo'), 'has <td>redirect</td>' => array('tag' => 'td', 'content' => 'redirect'), 'has <ins>Q21</ins>' => array('tag' => 'ins', 'content' => 'Q21'));
$changeRedirTags = array('has <td>redirect</td>' => array('tag' => 'td', 'content' => 'redirect'), 'has <del>Q21</del>' => array('tag' => 'del', 'content' => 'Q21'), 'has <ins>Q22</del>' => array('tag' => 'ins', 'content' => 'Q22'));
$empty = ItemContent::newFromItem($emptyItem);
$itemContent = ItemContent::newFromItem($item);
$itemContent2 = ItemContent::newFromItem($item2);
$redirectContent = ItemContent::newFromRedirect($redirect, Title::newFromText($redirect->getEntityId()->getSerialization()));
$redirectContent2 = ItemContent::newFromRedirect($redirect2, Title::newFromText($redirect2->getEntityId()->getSerialization()));
return array('empty' => array($empty, $empty, array('empty' => '/^$/')), 'same' => array($itemContent, $itemContent, array('empty' => '/^$/')), 'from emtpy' => array($empty, $itemContent, $insTags), 'to empty' => array($itemContent, $empty, $delTags), 'changed' => array($itemContent, $itemContent2, $changeTags), 'to redirect' => array($itemContent, $redirectContent, $toRedirTags), 'from redirect' => array($redirectContent, $itemContent, $fromRedirTags), 'redirect changed' => array($redirectContent, $redirectContent2, $changeRedirTags));
}
示例3: makeEntity
protected function makeEntity(EntityId $id, array $statements = array())
{
$item = new Item($id);
$item->setLabel('en', "label:{$id}");
$item->setDescription('en', "description:{$id}");
$item->setStatements(new StatementList($statements));
return $item;
}
示例4: getSimpleEntities
private function getSimpleEntities()
{
$item = new Item();
$item->setLabel('en', 'Item');
$item->setDescription('en', 'Item description');
$property = Property::newFromType('string');
$property->setLabel('en', 'Property');
$property->setDescription('en', 'Property description');
return array($item, $property);
}
示例5: testTitleText_ItemHasNolabel
public function testTitleText_ItemHasNolabel()
{
$entityParserOutputGenerator = $this->newEntityParserOutputGenerator();
$item = new Item(new ItemId('Q7799929'));
$item->setDescription('en', 'a kitten');
$timestamp = wfTimestamp(TS_MW);
$revision = new EntityRevision($item, 13045, $timestamp);
$parserOutput = $entityParserOutputGenerator->getParserOutput($revision, $this->getParserOptions());
$this->assertEquals('Q7799929', $parserOutput->getExtensionData('wikibase-titletext'), 'title text');
}
示例6: createNewItem
/**
* Creates a new item and returns its id.
*
* @return string
*/
private function createNewItem()
{
$item = new Item();
// add data and check if it is shown in the form
$item->setLabel('de', 'foo');
$item->setDescription('de', 'foo');
$item->setAliases('de', array('foo'));
// save the item
$store = WikibaseRepo::getDefaultInstance()->getEntityStore();
$store->saveEntity($item, "testing", $GLOBALS['wgUser'], EDIT_NEW | EntityContent::EDIT_IGNORE_CONSTRAINTS);
// return the id
return $item->getId()->getSerialization();
}
示例7: generateProvider
public function generateProvider()
{
$item = new Item();
$item->setLabel('en', 'Test');
$item->setLabel('de', 'Testen');
$item->setDescription('en', 'city in Spain');
$item->setAliases('en', array('abc', 'cde'));
$item->setAliases('de', array('xyz', 'uvw'));
$item->getSiteLinkList()->addNewSiteLink('dewiki', 'Berlin');
$item->getSiteLinkList()->addNewSiteLink('enwiki', 'Rome');
$patterns = array('/^Test$/', '/^Testen$/', '/^city in Spain$/', '/^abc$/', '/^cde$/', '/^uvw$/', '/^xyz$/', '/^(?!abcde).*$/', '/^Berlin$/', '/^Rome$/');
return array(array($item, $patterns));
}
示例8: testSerialize
public function testSerialize()
{
$item = new Item();
$item->setLabel('de', 'German');
$item->setDescription('de', 'German');
$item->setAliases('de', array('German'));
$item->setAliases('en', array('English'));
$item->getStatements()->addNewStatement(new PropertyNoValueSnak(1));
$instance = $this->newInstance();
$serialization = $instance->serialize($item);
$expected = array('type' => 'item', 'labels' => array('en' => array('source-language' => '<SOURCE>')), 'descriptions' => array('en' => array('source-language' => '<SOURCE>')), 'aliases' => array('en' => array(array('language' => 'en', 'value' => 'English'))), 'claims' => array('P1' => array(array('mainsnak' => array('snaktype' => 'novalue', 'property' => 'P1', 'datatype' => '<DATATYPE>'), 'type' => 'statement', 'rank' => 'normal'))));
$this->assertSame($expected, $serialization);
}
示例9: itemProvider
public function itemProvider()
{
$items = array();
$items[] = new Item();
$item = new Item();
$item->setDescription('en', 'foo');
$items[] = $item;
$item = new Item();
$item->setDescription('en', 'foo');
$item->setDescription('de', 'foo');
$item->setLabel('en', 'foo');
$item->setAliases('de', array('bar', 'baz'));
$items[] = $item;
/** @var Item $item */
$item = $item->copy();
$item->getStatements()->addNewStatement(new PropertyNoValueSnak(new PropertyId('P42')));
$items[] = $item;
$argLists = array();
foreach ($items as $item) {
$argLists[] = array($item);
}
return $argLists;
}
示例10: getItem
private function getItem()
{
$item = new Item(new ItemId('Q23'));
$item->setLabel('en', 'Moskow');
$item->setLabel('de', 'Moskau');
$item->setDescription('de', 'Hauptstadt Russlands');
return $item;
}
示例11: provideNewEntity
/**
* @return Entity
*/
protected function provideNewEntity()
{
$item = new Item(new ItemId('Q23'));
$item->setDescription('en', 'DUPE');
$item->setDescription('fr', 'DUPE');
return $item;
}
示例12: getMockRepository
/**
* @return MockRepository
*/
private function getMockRepository()
{
$repo = new MockRepository();
$user = $this->getUser('EditEntityTestUser1');
$otherUser = $this->getUser('EditEntityTestUser2');
/* @var Item $item */
$item = new Item(new ItemId('Q17'));
$item->setLabel('en', 'foo');
$repo->putEntity($item, 10, 0, $user);
$item = new Item(new ItemId('Q17'));
$item->setLabel('en', 'bar');
$repo->putEntity($item, 11, 0, $otherUser);
$item = new Item(new ItemId('Q17'));
$item->setLabel('en', 'bar');
$item->setLabel('de', 'bar');
$repo->putEntity($item, 12, 0, $user);
$item = new Item(new ItemId('Q17'));
$item->setLabel('en', 'test');
$item->setLabel('de', 'bar');
$item->setDescription('en', 'more testing');
$repo->putEntity($item, 13, 0, $user);
return $repo;
}
示例13: setupGetEntities
protected function setupGetEntities()
{
$one = new Item(new ItemId('Q1'));
$one->setLabel('en', 'one');
$two = new Item(new ItemId('Q2'));
$two->setLabel('en', 'two');
$three = new Item(new ItemId('Q3'));
$three->setLabel('en', 'three');
$three->setLabel('de', 'drei');
$three->setDescription('en', 'the third');
$prop = Property::newFromType('string');
$prop->setId(4);
$prop->setLabel('en', 'property!');
$this->repo->putEntity($one, 1001);
$this->repo->putEntity($two, 1002);
$this->repo->putEntity($three, 1003);
$this->repo->putEntity($prop, 1101);
$one->setLabel('de', "eins");
$this->repo->putEntity($one, 1011);
}
示例14: makeItemWithDescription
/**
* @param string $id
* @param string $label
*
* @return Item
*/
private function makeItemWithDescription($id, $label)
{
$item = new Item(new ItemId($id));
$item->setDescription('en', $label);
return $item;
}
示例15: getEntityLookup
/**
* @return EntityLookup
*/
private function getEntityLookup()
{
$entityLookup = new InMemoryEntityLookup();
$entityLookup->addException(new EntityLookupException(new ItemId('Q503')));
$item = new Item(new ItemId('Q116'));
$item->setLabel('en', 'New York City');
$item->setLabel('es', 'Nueva York');
$item->setDescription('de', 'Metropole an der Ostküste der Vereinigten Staaten');
$item->setDescription('en', 'largest city in New York and the United States of America');
$entityLookup->addEntity($item);
$item = new Item(new ItemId('Q117'));
$item->setLabel('de', 'Berlin');
$entityLookup->addEntity($item);
return $entityLookup;
}