本文整理匯總了PHP中Joomla\Registry\Registry::extract方法的典型用法代碼示例。如果您正苦於以下問題:PHP Registry::extract方法的具體用法?PHP Registry::extract怎麽用?PHP Registry::extract使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Joomla\Registry\Registry
的用法示例。
在下文中一共展示了Registry::extract方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testExtract
/**
* Test the Joomla\Registry\Registry::extract method
*
* @return void
*
* @covers Joomla\Registry\Registry::extract
* @since 1.2.0
*/
public function testExtract()
{
$a = new Registry(array('foo' => 'bar', 'subset' => array('data1' => 'test1', 'data2' => 'test2', 'data3' => array(1, 2, 3))));
$b = $a->extract('subset');
$c = $a->extract('subset.data3');
$this->assertInstanceOf('\\Joomla\\Registry\\Registry', $b, 'Line ' . __LINE__ . ' - Object $b should be an instance of Registry.');
$this->assertInstanceOf('\\Joomla\\Registry\\Registry', $c, 'Line ' . __LINE__ . ' - Object $c should be an instance of Registry.');
$this->assertEquals('test2', $b->get('data2'), 'Test sub-registry path');
}
示例2: testARegistryCannotBeExtractedFromNullData
/**
* @testdox A Registry cannot be extracted from null data
*
* @covers Joomla\Registry\Registry::extract
*/
public function testARegistryCannotBeExtractedFromNullData()
{
$a = new Registry();
$this->assertNull($a->extract('foo'), 'A Registry cannot be extracted from null data.');
}