예제 #1
0
 public function test_replace()
 {
     $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
 /**
  * @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));
     list($this->idpEntityId, $this->spEntityId, $this->nameId, $this->nameIdFormat, $this->sessionIndex, $this->sessionInstant, $this->firstAuthOn, $this->lastAuthOn, $options, $this->parameters) = $data;
     // if deserialized from old format, set old options to new parameters
     if ($options && $this->parameters->count() == 0) {
         $this->parameters->replace($options);
     }
 }