85        if (!
$xml->hasAttribute(
'contactType')) {
 
   86            throw new \Exception(
'Missing contactType on ContactPerson.');
 
   88        $this->contactType = 
$xml->getAttribute(
'contactType');
 
   98        foreach (
$xml->attributes as $attr) {
 
   99            if ($attr->nodeName == 
"contactType") {
 
  103            $this->ContactPersonAttributes[$attr->nodeName] = $attr->nodeValue;
 
  116        assert(is_string(
$name));
 
  138        assert(is_string(
$name));
 
  145            throw new \Exception(
'More than one ' . 
$name . 
' in ' . $parent->tagName);
 
  157    public function toXML(\DOMElement $parent)
 
  159        assert(is_string($this->contactType));
 
  161        assert(is_null($this->Company) || is_string($this->Company));
 
  162        assert(is_null($this->GivenName) || is_string($this->GivenName));
 
  163        assert(is_null($this->SurName) || is_string($this->SurName));
 
  164        assert(is_array($this->EmailAddress));
 
  165        assert(is_array($this->TelephoneNumber));
 
  166        assert(is_array($this->ContactPersonAttributes));
 
  168        $doc = $parent->ownerDocument;
 
  171        $parent->appendChild($e);
 
  173        $e->setAttribute(
'contactType', $this->contactType);
 
  175        foreach ($this->ContactPersonAttributes as $attr => $val) {
 
  176            $e->setAttribute($attr, $val);
 
  181        if (isset($this->Company)) {
 
  184        if (isset($this->GivenName)) {
 
  187        if (isset($this->SurName)) {
 
  190        if (!empty($this->EmailAddress)) {
 
  193        if (!empty($this->TelephoneNumber)) {
 
An exception for terminatinating execution or to throw for unit testing.
const NS_MD
The namespace for the SAML 2 metadata.
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
static addString(\DOMElement $parent, $namespace, $name, $value)
Append string element.
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
static getList(\DOMElement $parent)
Get a list of Extensions in the given element.
static addList(\DOMElement $parent, array $extensions)
Add a list of Extensions to the given element.