예제 #1
0
파일: UI.php 프로젝트: shupp/openid
 /**
  * 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);
 }
예제 #2
0
파일: AX.php 프로젝트: shupp/openid
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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'));
 }