コード例 #1
0
 public function testReplace()
 {
     $bag = new ParameterBag(array('foo' => 'bar'));
     $bag->replace(array('FOO' => 'BAR'));
     $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument');
     $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
 }
コード例 #2
0
 /**
  * Sets the Custom Options
  * @param array $options
  * @return \Acilia\Component\FragmentCache\Configuration\FragmentCache
  */
 public function setOptions($options)
 {
     if (!is_array($options)) {
         $options = array();
     }
     $this->options->replace($options);
     return $this;
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 public function transform(ParameterBag $item)
 {
     if (!$this->field) {
         // expand root-level attributes
         $item->replace($this->expand($item->all()));
         return;
     }
     // proceed only when the field exists and is an array
     $value = $item->get($this->field);
     if (!is_array($value)) {
         return;
     }
     $item->set($this->field, $this->expand($value));
 }
コード例 #4
0
 /**
  * @inheritdoc
  */
 public function transform(ParameterBag $item)
 {
     $parameters = $item->all();
     $this->trimValues($parameters);
     $item->replace($parameters);
 }
コード例 #5
0
 /**
  * @inheritdoc
  */
 public function transform(ParameterBag $item)
 {
     $parameters = $item->all();
     $this->stripKeysPunctuation($parameters);
     $item->replace($parameters);
 }
コード例 #6
0
 /**
  * @inheritdoc
  */
 public function transform(ParameterBag $item)
 {
     $parameters = $item->all();
     $this->lowercaseKeys($parameters);
     $item->replace($parameters);
 }