7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
16
* @package Zend_InfoCard
17
* @subpackage Zend_InfoCard_Xml
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
20
* @version $Id: EncryptedData.php 9094 2008-03-30 18:36:55Z thomas $
24
* Zend_InfoCard_Xml_EncryptedData
26
require_once 'Zend/InfoCard/Xml/Exception.php';
29
* A factory class for producing Zend_InfoCard_Xml_EncryptedData objects based on
30
* the type of XML document provided
33
* @package Zend_InfoCard
34
* @subpackage Zend_InfoCard_Xml
35
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
36
* @license http://framework.zend.com/license/new-bsd New BSD License
38
final class Zend_InfoCard_Xml_EncryptedData
41
* Constructor (disabled)
45
private function __construct()
50
* Returns an instance of the class
52
* @param string $xmlData The XML EncryptedData String
53
* @return Zend_InfoCard_Xml_EncryptedData_Abstract
54
* @throws Zend_InfoCard_Xml_Exception
56
static public function getInstance($xmlData)
59
if($xmlData instanceof Zend_InfoCard_Xml_Element) {
60
$strXmlData = $xmlData->asXML();
61
} else if (is_string($xmlData)) {
62
$strXmlData = $xmlData;
64
throw new Zend_InfoCard_Xml_Exception("Invalid Data provided to create instance");
67
$sxe = simplexml_load_string($strXmlData);
69
switch($sxe['Type']) {
70
case 'http://www.w3.org/2001/04/xmlenc#Element':
71
include_once 'Zend/InfoCard/Xml/EncryptedData/XmlEnc.php';
72
return simplexml_load_string($strXmlData, 'Zend_InfoCard_Xml_EncryptedData_XmlEnc');
74
throw new Zend_InfoCard_Xml_Exception("Unknown EncryptedData type found");