本文整理汇总了PHP中ParserOutput::setProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::setProperty方法的具体用法?PHP ParserOutput::setProperty怎么用?PHP ParserOutput::setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::setProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProperties
/**
* @covers ParserOutput::setProperty
* @covers ParserOutput::getProperty
* @covers ParserOutput::unsetProperty
* @covers ParserOutput::getProperties
*/
public function testProperties()
{
$po = new ParserOutput();
$po->setProperty('foo', 'val');
$properties = $po->getProperties();
$this->assertEquals($po->getProperty('foo'), 'val');
$this->assertEquals($properties['foo'], 'val');
$po->setProperty('foo', 'second val');
$properties = $po->getProperties();
$this->assertEquals($po->getProperty('foo'), 'second val');
$this->assertEquals($properties['foo'], 'second val');
$po->unsetProperty('foo');
$properties = $po->getProperties();
$this->assertEquals($po->getProperty('foo'), false);
$this->assertArrayNotHasKey('foo', $properties);
}
示例2: egOgmcParserOutputApplyValues
function egOgmcParserOutputApplyValues(OutputPage $out, ParserOutput $parserOutput, $data)
{
wfProfileIn(__METHOD__);
global $wgTitle;
$articleId = $wgTitle->getArticleID();
$titleImage = $titleDescription = null;
wfRunHooks('OpenGraphMeta:beforeCustomFields', array($articleId, &$titleImage, &$titleDescription));
// Get description from ArticleService
if (is_null($titleDescription)) {
$DESC_LENGTH = 500;
$articleService = new ArticleService($wgTitle);
$titleDescription = $articleService->getTextSnippet($DESC_LENGTH);
}
if (!empty($titleDescription)) {
$parserOutput->setProperty('description', $titleDescription);
$out->mDescription = $parserOutput->getProperty('description');
}
wfProfileOut(__METHOD__);
}
示例3: setDefaultSort
/**
* Mutator for $mDefaultSort
*
* @param string $sort New value
*/
public function setDefaultSort($sort)
{
$this->mDefaultSort = $sort;
$this->mOutput->setProperty('defaultsort', $sort);
}
示例4: saveToParserOutput
protected function saveToParserOutput(\ParserOutput $parserOutput, Nodes\NodeInfobox $raw)
{
if ($raw) {
$infoboxes = $parserOutput->getProperty(PortableInfoboxDataService::INFOBOXES_PROPERTY_NAME);
$infoboxes[] = ['data' => $raw->getRenderData(), 'sources' => $raw->getSource()];
$parserOutput->setProperty(PortableInfoboxDataService::INFOBOXES_PROPERTY_NAME, $infoboxes);
}
}