Skip to content
Snippets Groups Projects
Commit 665bfa90 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

use a local private function

parent 18e94d8e
No related branches found
No related tags found
No related merge requests found
...@@ -98,14 +98,14 @@ sub parse { ...@@ -98,14 +98,14 @@ sub parse {
binding => $sso->getAttribute('Binding'), binding => $sso->getAttribute('Binding'),
location => $sso->getAttribute('Location'), location => $sso->getAttribute('Location'),
index => $sso->getAttribute('index'), index => $sso->getAttribute('index'),
isdefault => IdPAccountManager::Tools::boolean2integer( isdefault => _boolean2integer(
$sso->getAttribute('isDefault') $sso->getAttribute('isDefault')
) )
}; };
} }
foreach my $requestedattribute ( foreach my $attribute (
$child->getElementsByLocalName('RequestedAttribute')) $child->getElementsByLocalName('RequestedAttribute'))
{ {
...@@ -114,15 +114,14 @@ sub parse { ...@@ -114,15 +114,14 @@ sub parse {
{ {
'friendly_name' => 'friendly_name' =>
IdPAccountManager::Tools::encode_utf8( IdPAccountManager::Tools::encode_utf8(
$requestedattribute->getAttribute('FriendlyName') $attribute->getAttribute('FriendlyName')
), ),
'name' => IdPAccountManager::Tools::encode_utf8( 'name' => IdPAccountManager::Tools::encode_utf8(
$requestedattribute->getAttribute('Name') $attribute->getAttribute('Name')
), ),
'is_required' => 'is_required' => _boolean2integer(
IdPAccountManager::Tools::boolean2integer( $attribute->getAttribute('isRequired')
$requestedattribute->getAttribute('isRequired') )
)
}; };
} }
...@@ -251,6 +250,13 @@ sub print { ...@@ -251,6 +250,13 @@ sub print {
print $fd $root->toString(); print $fd $root->toString();
} }
sub _boolean2integer {
return
$_[0] eq 'true' ? 1 :
$_[0] eq 'false' ? 0 :
undef;
}
1; 1;
__END__ __END__
......
...@@ -211,19 +211,6 @@ sub escape_quotes { ...@@ -211,19 +211,6 @@ sub escape_quotes {
return $string; return $string;
} }
## returns an integer (0 or 1), given an input string ('true' or 'false')
sub boolean2integer {
my ($boolean) = @_;
if ($boolean eq 'true') {
return 1;
} elsif ($boolean eq 'false') {
return 0;
}
return undef;
}
1; 1;
__END__ __END__
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment