diff -r 000000000000 -r 4eba9c11703f web/Zend/InfoCard/Xml/KeyInfo.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/Zend/InfoCard/Xml/KeyInfo.php Mon Dec 13 18:29:26 2010 +0100 @@ -0,0 +1,90 @@ +asXML(); + } else if (is_string($xmlData)) { + $strXmlData = $xmlData; + } else { + throw new Zend_InfoCard_Xml_Exception("Invalid Data provided to create instance"); + } + + $sxe = simplexml_load_string($strXmlData); + + $namespaces = $sxe->getDocNameSpaces(); + + if(!empty($namespaces)) { + foreach($sxe->getDocNameSpaces() as $namespace) { + switch($namespace) { + case 'http://www.w3.org/2000/09/xmldsig#': + include_once 'Zend/InfoCard/Xml/KeyInfo/XmlDSig.php'; + return simplexml_load_string($strXmlData, 'Zend_InfoCard_Xml_KeyInfo_XmlDSig'); + default: + + throw new Zend_InfoCard_Xml_Exception("Unknown KeyInfo Namespace provided"); + // We are ignoring these lines, as XDebug reports each as a "non executed" line + // which breaks my coverage % + // @codeCoverageIgnoreStart + } + } + } + // @codeCoverageIgnoreEnd + + include_once 'Zend/InfoCard/Xml/KeyInfo/Default.php'; + return simplexml_load_string($strXmlData, 'Zend_InfoCard_Xml_KeyInfo_Default'); + } +}