add() public method

Adds parameters to the service container parameters.
public add ( array $parameters )
$parameters array An array of parameters
Ejemplo n.º 1
0
 public function testEscapeValue()
 {
     $bag = new ParameterBag();
     $bag->add(array('foo' => $bag->escapeValue(array('bar' => array('ding' => 'I\'m a bar %foo %bar', 'zero' => null))), 'bar' => $bag->escapeValue('I\'m a %foo%')));
     $this->assertEquals('I\'m a %%foo%%', $bag->get('bar'), '->escapeValue() escapes % by doubling it');
     $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %%foo %%bar', 'zero' => null)), $bag->get('foo'), '->escapeValue() escapes % by doubling it');
 }
Ejemplo n.º 2
0
 /**
  * @param array $parameters
  *
  * @return $this
  */
 public function setParameters($parameters)
 {
     $this->parameters->clear();
     $this->parameters->add($parameters);
     return $this;
 }