Пример #1
0
 /**
  * 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
 /**
  * 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
 /**
  * testGetNameSpace 
  * 
  * @return void
  */
 public function testGetNameSpace()
 {
     $this->assertSame($this->object->getNamespace(), 'http://example.com/mock');
 }
Пример #4
0
 /**
  * Adds an extension to an OpenID_Message object.
  * 
  * @param OpenID_Extension $extension Instance of OpenID_Extension
  * 
  * @see OpenID_Extension
  * @return void
  */
 public function addExtension(OpenID_Extension $extension)
 {
     $extension->toMessage($this);
 }