本文整理匯總了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);
}
}