本文整理汇总了PHP中Joomla\Registry\Registry::flatten方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::flatten方法的具体用法?PHP Registry::flatten怎么用?PHP Registry::flatten使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joomla\Registry\Registry
的用法示例。
在下文中一共展示了Registry::flatten方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFlatten
/**
* Test flatten.
*
* @return void
*
* @covers Joomla\Registry\Registry::flatten
* @since 1.3.0
*/
public function testFlatten()
{
$a = new Registry();
$a->set('flower.sunflower', 'light');
$a->set('flower.sakura', 'samurai');
$flatted = $a->flatten();
$this->assertEquals($flatted['flower.sunflower'], 'light');
$flatted = $a->flatten('/');
$this->assertEquals($flatted['flower/sakura'], 'samurai');
}
示例2: testTheRegistryCanBeFlattenedToAnArray
/**
* @testdox The Registry can be flattened to an array
*
* @covers Joomla\Registry\Registry::flatten
* @covers Joomla\Registry\Registry::toFlatten
*/
public function testTheRegistryCanBeFlattenedToAnArray()
{
$a = new Registry(array('flower' => array('sunflower' => 'light', 'sakura' => 'samurai')));
$flattened = $a->flatten();
$this->assertEquals($flattened['flower.sunflower'], 'light', 'The Registry is flattened to an array.');
$flattened = $a->flatten('/');
$this->assertEquals($flattened['flower/sakura'], 'samurai', 'The Registry is flattened to an array with a custom path separator.');
}