예제 #1
0
 public function test_remove()
 {
     $bag = new ParameterBag(array('foo' => 'bar'));
     $bag->add(array('bar' => 'bas'));
     $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all());
     $bag->remove('bar');
     $this->assertEquals(array('foo' => 'bar'), $bag->all());
 }
예제 #2
0
 /**
  * @param string $serialized
  *
  * @return void
  */
 public function unserialize($serialized)
 {
     $data = unserialize($serialized);
     // add a few extra elements in the array to ensure that we have enough keys when unserializing
     // older data which does not include all properties.
     $data = array_merge($data, array_fill(0, 5, null));
     $oldOptions = null;
     list($this->localSessionId, $this->ssoSessions, $oldOptions, $this->parameters) = $data;
     // in case it was serialized in old way, copy old options to parameters
     if ($oldOptions && $this->parameters->count() == 0) {
         $this->parameters->add($oldOptions);
     }
 }