本文整理汇总了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.');
}