本文整理匯總了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;
}