Esempio n. 1
0
 protected function parseParameters(BuilderConfiguration $configuration, $xml, $file)
 {
     if (!$xml->parameters) {
         return;
     }
     $configuration->getParameterBag()->add($xml->parameters->getArgumentsAsPhp('parameter'));
 }
 /**
  * @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');
 }
 /**
  * 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;
 }