29 throw new \InvalidArgumentException(
30 'The attributes array is not an array, it is: '.print_r(
$attributes,
true).
'.' 34 if (!is_string($expected)) {
35 throw new \InvalidArgumentException(
36 'The expected attribute is not a string, it is: '.print_r($expected,
true).
'.' 41 throw new \SimpleSAML_Error_Exception(
"No such attribute '".$expected.
"' found.");
45 if (!is_array($attribute)) {
46 throw new \InvalidArgumentException(
'The attributes array is not normalized, values should be arrays.');
49 if (count($attribute) === 0) {
50 throw new \SimpleSAML_Error_Exception(
"Empty attribute '".$expected.
"'.'");
51 } elseif (count($attribute) > 1) {
52 if ($allow_multiple ===
false) {
53 throw new \SimpleSAML_Error_Exception(
54 'More than one value found for the attribute, multiple values not allowed.' 58 return reset($attribute);
82 throw new \InvalidArgumentException(
83 'The attributes array is not an array, it is: '.print_r(
$attributes,
true).
'".' 89 if (!is_string(
$name)) {
90 throw new \InvalidArgumentException(
'Invalid attribute name: "'.print_r(
$name,
true).
'".');
96 if (!is_string($value)) {
97 throw new \InvalidArgumentException(
98 'Invalid attribute value for attribute '.
$name.
': "'.print_r($value,
true).
'".' 124 $slash = strrpos(
$name,
'/');
125 if ($slash !==
false) {
126 $defaultns = substr(
$name, 0, $slash);
129 return array(htmlspecialchars($defaultns), htmlspecialchars(
$name));
static getAttributeNamespace($name, $defaultns)
Extract an attribute's namespace, or revert to default.
static normalizeAttributesArray($attributes)
Validate and normalize an array with attributes.
static arrayize($data, $index=0)
Put a non-array variable into an array.
if(array_key_exists('yes', $_REQUEST)) $attributes
static getExpectedAttribute($attributes, $expected, $allow_multiple=false)
Look for an attribute in a normalized attributes array, failing if it's not there.