Basisklasse für Auth_OpenID_AX_FetchResponse und Auth_OpenID_AX_StoreRequest.
Öffentliche Methoden | |
Auth_OpenID_AX_KeyValueMessage () | |
addValue ($type_uri, $value) | |
setValues ($type_uri, &$values) | |
_getExtensionKVArgs (&$aliases) | |
parseExtensionArgs ($ax_args) | |
getSingle ($type_uri, $default=null) | |
get ($type_uri) | |
count ($type_uri) |
Definiert in Zeile 540 der Datei AX.php.
_getExtensionKVArgs | ( | &$ | aliases | ) |
Get the extension arguments for the key/value pairs contained in this message.
aliases,: | An alias mapping. Set to None if you don't care about the aliases for this request. |
Definiert in Zeile 589 der Datei AX.php.
00591 { 00592 if ($aliases === null) { 00593 $aliases = new Auth_OpenID_NamespaceMap(); 00594 } 00595 00596 $ax_args = array(); 00597 00598 foreach ($this->data as $type_uri => $values) { 00599 $alias = $aliases->add($type_uri); 00600 00601 $ax_args['type.' . $alias] = $type_uri; 00602 $ax_args['count.' . $alias] = strval(count($values)); 00603 00604 foreach ($values as $i => $value) { 00605 $key = sprintf('value.%s.%d', $alias, $i + 1); 00606 $ax_args[$key] = $value; 00607 } 00608 } 00609 00610 return $ax_args;
addValue | ( | $ | type_uri, | |
$ | value | |||
) |
Add a single value for the given attribute type to the message. If there are already values specified for this type, this value will be sent in addition to the values already specified.
type_uri,: | The URI for the attribute | |
value,: | The value to add to the response to the relying party for this attribute |
Definiert in Zeile 558 der Datei AX.php.
00560 { 00561 if (!array_key_exists($type_uri, $this->data)) { 00562 $this->data[$type_uri] = array(); 00563 } 00564 00565 $values =& $this->data[$type_uri]; 00566 $values[] = $value;
count | ( | $ | type_uri | ) |
Get the number of responses for a particular attribute in this fetch_response message.
type_uri,: | The URI of the attribute |
Definiert in Zeile 774 der Datei AX.php.
00776 { 00777 if (array_key_exists($type_uri, $this->data)) { 00778 return count($this->get($type_uri)); 00779 } else { 00780 return new Auth_OpenID_AX_Error( 00781 sprintf("Type URI %s not found in response", 00782 $type_uri) 00783 ); 00784 }
get | ( | $ | type_uri | ) |
Get the list of values for this attribute in the fetch_response.
XXX: what to do if the values are not present? default parameter? this is funny because it's always supposed to return a list, so the default may break that, though it's provided by the user's code, so it might be okay. If no default is supplied, should the return be None or []?
type_uri,: | The URI of the attribute |
Definiert in Zeile 752 der Datei AX.php.
00754 { 00755 if (array_key_exists($type_uri, $this->data)) { 00756 return $this->data[$type_uri]; 00757 } else { 00758 return new Auth_OpenID_AX_Error( 00759 sprintf("Type URI %s not found in response", 00760 $type_uri) 00761 ); 00762 }
getSingle | ( | $ | type_uri, | |
$ | default = null | |||
) |
Get a single value for an attribute. If no value was sent for this attribute, use the supplied default. If there is more than one value for this attribute, this method will fail.
type_uri,: | The URI for the attribute | |
default,: | The value to return if the attribute was not sent in the fetch_response. |
Definiert in Zeile 721 der Datei AX.php.
00723 { 00724 $values = Auth_OpenID::arrayGet($this->data, $type_uri); 00725 if (!$values) { 00726 return $default; 00727 } else if (count($values) == 1) { 00728 return $values[0]; 00729 } else { 00730 return new Auth_OpenID_AX_Error( 00731 sprintf('More than one value present for %s', 00732 $type_uri) 00733 ); 00734 }
parseExtensionArgs | ( | $ | ax_args | ) |
Parse attribute exchange key/value arguments into this object.
ax_args,: | The attribute exchange fetch_response arguments, with namespacing removed. |
Erneute Implementation in Auth_OpenID_AX_FetchResponse.
Definiert in Zeile 620 der Datei AX.php.
00622 { 00623 $result = $this->_checkMode($ax_args); 00624 if (Auth_OpenID_AX::isError($result)) { 00625 return $result; 00626 } 00627 00628 $aliases = new Auth_OpenID_NamespaceMap(); 00629 00630 foreach ($ax_args as $key => $value) { 00631 if (strpos($key, 'type.') === 0) { 00632 $type_uri = $value; 00633 $alias = substr($key, 5); 00634 00635 $result = Auth_OpenID_AX_checkAlias($alias); 00636 00637 if (Auth_OpenID_AX::isError($result)) { 00638 return $result; 00639 } 00640 00641 $alias = $aliases->addAlias($type_uri, $alias); 00642 00643 if ($alias === null) { 00644 return new Auth_OpenID_AX_Error( 00645 sprintf("Could not add alias %s for URI %s", 00646 $alias, $type_uri) 00647 ); 00648 } 00649 } 00650 } 00651 00652 foreach ($aliases->iteritems() as $pair) { 00653 list($type_uri, $alias) = $pair; 00654 00655 if (array_key_exists('count.' . $alias, $ax_args)) { 00656 00657 $count_key = 'count.' . $alias; 00658 $count_s = $ax_args[$count_key]; 00659 00660 $count = Auth_OpenID::intval($count_s); 00661 00662 if ($count === false) { 00663 return new Auth_OpenID_AX_Error( 00664 sprintf("Integer value expected for %s, got %s", 00665 'count. %s' . $alias, $count_s, 00666 Auth_OpenID_AX_UNLIMITED_VALUES) 00667 ); 00668 } 00669 00670 $values = array(); 00671 for ($i = 1; $i < $count + 1; $i++) { 00672 $value_key = sprintf('value.%s.%d', $alias, $i); 00673 00674 if (!array_key_exists($value_key, $ax_args)) { 00675 return new Auth_OpenID_AX_Error( 00676 sprintf( 00677 "No value found for key %s", 00678 $value_key)); 00679 } 00680 00681 $value = $ax_args[$value_key]; 00682 $values[] = $value; 00683 } 00684 } else { 00685 $key = 'value.' . $alias; 00686 00687 if (!array_key_exists($key, $ax_args)) { 00688 return new Auth_OpenID_AX_Error( 00689 sprintf( 00690 "No value found for key %s", 00691 $key)); 00692 } 00693 00694 $value = $ax_args['value.' . $alias]; 00695 00696 if ($value == '') { 00697 $values = array(); 00698 } else { 00699 $values = array($value); 00700 } 00701 } 00702 00703 $this->data[$type_uri] = $values; 00704 } 00705 00706 return true;
setValues | ( | $ | type_uri, | |
&$ | values | |||
) |
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|