本文整理汇总了PHP中ConfigFactory::getConfigNames方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigFactory::getConfigNames方法的具体用法?PHP ConfigFactory::getConfigNames怎么用?PHP ConfigFactory::getConfigNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigFactory
的用法示例。
在下文中一共展示了ConfigFactory::getConfigNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetConfigNames
/**
* @covers ConfigFactory::register
*/
public function testGetConfigNames()
{
$factory = new ConfigFactory();
$factory->register('foo', 'GlobalVarConfig::newInstance');
$factory->register('bar', new HashConfig());
$this->assertEquals(['foo', 'bar'], $factory->getConfigNames());
}
示例2: makeTestConfigFactoryInstantiator
/**
* @param ConfigFactory $oldFactory
* @param Config[] $configurations
*
* @return Closure
*/
private static function makeTestConfigFactoryInstantiator(ConfigFactory $oldFactory, array $configurations)
{
return function (MediaWikiServices $services) use($oldFactory, $configurations) {
$factory = new ConfigFactory();
// clone configurations from $oldFactory that are not overwritten by $configurations
$namesToClone = array_diff($oldFactory->getConfigNames(), array_keys($configurations));
foreach ($namesToClone as $name) {
$factory->register($name, $oldFactory->makeConfig($name));
}
foreach ($configurations as $name => $config) {
$factory->register($name, $config);
}
return $factory;
};
}