/** * @param string $serialized The string representation of the object * * @return void */ public function unserialize($serialized) { $nonce = null; $this->parameters = new ParameterBag(); list($this->id, $nonce, $parameters) = unserialize($serialized); $this->parameters->unserialize($parameters); }
/** * @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); } }
/** * @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); } }
public function test_has() { $bag = new ParameterBag(array('foo' => 'bar')); $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); $this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined'); }