本文整理汇总了PHP中Symfony\Components\DependencyInjection\BuilderConfiguration::getParameterBag方法的典型用法代码示例。如果您正苦于以下问题:PHP BuilderConfiguration::getParameterBag方法的具体用法?PHP BuilderConfiguration::getParameterBag怎么用?PHP BuilderConfiguration::getParameterBag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Components\DependencyInjection\BuilderConfiguration
的用法示例。
在下文中一共展示了BuilderConfiguration::getParameterBag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseParameters
protected function parseParameters(BuilderConfiguration $configuration, $xml, $file)
{
if (!$xml->parameters) {
return;
}
$configuration->getParameterBag()->add($xml->parameters->getArgumentsAsPhp('parameter'));
}
示例2: testGetParameterBag
/**
* @covers Symfony\Components\DependencyInjection\BuilderConfiguration::getParameterBag
*/
public function testGetParameterBag()
{
$configuration = new BuilderConfiguration();
$this->assertEquals(array(), $configuration->getParameterBag()->all(), '->getParameterBag() returns an empty bag if no parameter has been defined');
$configuration = new BuilderConfiguration(array(), new ParameterBag(array('foo' => 'bar')));
$this->assertEquals(array('foo' => 'bar'), $configuration->getParameterBag()->all(), '->getParameterBag() returns the parameter bag passed at construction time');
}
示例3: merge
/**
* Merges a BuilderConfiguration with the current one.
*
* @param BuilderConfiguration $configuration
*
* @return BuilderConfiguration The current instance
*/
public function merge(BuilderConfiguration $configuration = null)
{
if (null === $configuration) {
return;
}
$this->addDefinitions($configuration->getDefinitions());
$this->addAliases($configuration->getAliases());
$this->parameterBag->add($configuration->getParameterBag()->all());
foreach ($configuration->getResources() as $resource) {
$this->addResource($resource);
}
return $this;
}