From 4d56877dec623cf701db193738fd1b6e843bc927 Mon Sep 17 00:00:00 2001
From: Jacob Christiansen <jach@wayf.dk>
Date: Thu, 8 Oct 2009 12:10:33 +0000
Subject: [PATCH] Made addMeatdataSP20 and addMetadataIdP20 call addContact
 instead on only adding emailaddress and surname

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1832 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Metadata/SAMLBuilder.php | 32 ++++---------------------
 1 file changed, 5 insertions(+), 27 deletions(-)

diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php
index 2a2f447f2..e5411828a 100644
--- a/lib/SimpleSAML/Metadata/SAMLBuilder.php
+++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php
@@ -336,19 +336,8 @@ class SimpleSAML_Metadata_SAMLBuilder {
 		
 		if (array_key_exists('contacts', $metadata) && is_array($metadata['contacts']) ) {
 			foreach($metadata['contacts'] AS $contact) {
-				if (array_key_exists('contactType', $contact) && array_key_exists('EmailAddress', $contact)) {
-					$t = $this->createElement('ContactPerson');
-					$t->setAttribute('contactType', $contact['contactType']);
-					
-					if (array_key_exists('SurName', $contact)) {
-						$surname = $this->createTextElement('SurName', $contact['SurName']);
-						$t->appendChild($surname);
-					}
-					
-					$email = $this->createTextElement('EmailAddress', $contact['EmailAddress']);
-					$t->appendChild($email);
-					
-					$this->entityDescriptor->appendChild($t);
+				if (array_key_exists('contactType', $contact) && array_key_exists('emailAddress', $contact)) {
+                    $this->addContact($contact['contactType'], $contact);
 				}
 			}
 		}
@@ -408,19 +397,8 @@ class SimpleSAML_Metadata_SAMLBuilder {
 		
 		if (array_key_exists('contacts', $metadata) && is_array($metadata['contacts']) ) {
 			foreach($metadata['contacts'] AS $contact) {
-				if (array_key_exists('contactType', $contact) && array_key_exists('EmailAddress', $contact)) {
-					$t = $this->createElement('ContactPerson');
-					$t->setAttribute('contactType', $contact['contactType']);
-					
-					if (array_key_exists('SurName', $contact)) {
-						$surname = $this->createTextElement('SurName', $contact['SurName']);
-						$t->appendChild($surname);
-					}
-					
-					$email = $this->createTextElement('EmailAddress', $contact['EmailAddress']);
-					$t->appendChild($email);
-					
-					$this->entityDescriptor->appendChild($t);
+				if (array_key_exists('contactType', $contact) && array_key_exists('emailAddress', $contact)) {
+                    $this->addContact($contact['contactType'], $contact);
 				}
 			}
 		}
@@ -672,4 +650,4 @@ class SimpleSAML_Metadata_SAMLBuilder {
 
 }
 
-?>
\ No newline at end of file
+?>
-- 
GitLab