/** * Adds mode checking to set() * * @param mixed $key Key * @param mixed $value Value * * @return void */ public function set($key, $value) { if (strpos($key, 'mode') === 0 && !in_array($value, $this->validModes)) { throw new OpenID_Extension_Exception('Invalid UI mode: ' . $key); } parent::set($key, $value); }
/** * Adds some validation checking when setting a key, then calls the parent set() * * @param string $key Message key * @param mixed $value Key's value * * @return void */ public function set($key, $value) { if (strpos($key, 'mode') === 0 && !in_array($value, $this->validModes)) { throw new OpenID_Extension_Exception('Invalid AX mode: ' . $key); } if (preg_match('/^type[.]/', $key) && !filter_var($value, FILTER_VALIDATE_URL)) { throw new OpenID_Extension_Exception($key . ' is not a valid URI'); } parent::set($key, $value); }
/** * testFromMessageResponse * * @return void */ public function testFromMessageResponse() { $this->object = new OpenID_Extension_Mock(OpenID_Extension::RESPONSE); $this->object->set('four', 'foo'); $message = new OpenID_Message(); $this->assertNotSame('foo', $message->get('openid.mock.four')); $this->object->toMessage($message); $values = $this->object->fromMessageResponse($message); $this->assertSame($values['four'], $message->get('openid.mock.four')); }