public function loadPublicXmlKey($publicKey, $isFile = true, $objectId = null)
	{
		if (true === $isFile)
		{
			try
			{
				$publicKey = $this->loadFile($publicKey);
			}
			catch (\UnexpectedValueException $e)
			{
				throw $e;
			}
		}
		
		$keyNode = null;
		
		// if the key is a string, assume that it's valid XML markup and load it into a dom docuemnt
		if (is_string($publicKey) && strlen($publicKey))
		{
			$keyNode = new \DOMDocument;
			
			if (!@$keyNode->loadXML($publicKey))
			{
				throw new \UnexpectedValueException('The provided public XML key does not appear to be well structured XML');
			}
		}
		// DOM nodes are sexy as fuck
		else if (is_object($publicKey) && $publicKey instanceof DOMDocument)
		{
			$keyNode = $publicKey;
		}
		// woops, a bad key was provided :(
		else
		{
			throw new \UnexpectedValueException('Unsupported XML public key provided');
		}
		
		// add the key to the DOM
		return $this->appendXmlPublicKey($keyNode, $objectId);
	}
public function loadPublicXmlKey($publicKey, $isFile = true, $objectId = null)
	{
		if (true === $isFile)
		{
			try
			{
				$publicKey = $this->loadFile($publicKey);
			}
			catch (\UnexpectedValueException $e)
			{
				throw $e;
			}
		}
		
		$keyNode = null;
		
		// if the key is a string, assume that it's valid XML markup and load it into a dom docuemnt
		if (is_string($publicKey) && strlen($publicKey))
		{
			$keyNode = new \DOMDocument;
			
			if (!@$keyNode->loadXML($publicKey))
			{
				throw new \UnexpectedValueException('The provided public XML key does not appear to be well structured XML');
			}
		}
		// DOM nodes are sexy as fuck
		else if (is_object($publicKey) && $publicKey instanceof DOMDocument)
		{
			$keyNode = $publicKey;
		}
		// woops, a bad key was provided :(
		else
		{
			throw new \UnexpectedValueException('Unsupported XML public key provided');
		}
		
		// add the key to the DOM
		return $this->appendXmlPublicKey($keyNode, $objectId);
	}
public function loadPublicXmlKey ( $ publicKey , $ isFile = true , $ objectId = null ) { if ( true === $ isFile ) { try { $ publicKey = $ this -> loadFile ( $ publicKey ) ; } catch ( \ UnexpectedValueException $ e ) { throw $ e ; } } $ keyNode = null ; // if the key is a string, assume that it's valid XML markup and load it into a dom docuemnt if ( is_string ( $ publicKey ) && strlen ( $ publicKey ) ) { $ keyNode = new \ DOMDocument ; if ( ! @ $ keyNode -> loadXML ( $ publicKey ) ) { throw new \ UnexpectedValueException ( 'The provided public XML key does not appear to be well structured XML' ) ; } } // DOM nodes are sexy as fuck else if ( is_object ( $ publicKey ) && $ publicKey instanceof DOMDocument ) { $ keyNode = $ publicKey ; } // woops, a bad key was provided :( else { throw new \ UnexpectedValueException ( 'Unsupported XML public key provided' ) ; } // add the key to the DOM return $ this -> appendXmlPublicKey ( $ keyNode , $ objectId ) ; }
Loads a public key in an XML format.

The first argument provided to this function can be a path to the key (the second arg must be set to true).
Otherwise, you may pass the actual XML string as the first argument (set the second argument to false).
The third argument is needed to create a reference between the created <KeyValue/> element and its <Reference/>.

@param	DOMDocument|string			$publicKey	The DOMDocument containing the key, or a path to the key's location, or the key as a string
@param	string						$isFile		If set to true, the key will be loaded from the given path
@param	string						$objectId	ID attribute of the key (used to create a reference between the key and its <Reference/> node)
@throws	\UnexpectedValueException				Thrown when the provided key is in an unsupported format
@return	bool									True if the key was successfully loaded, false otherwise
Loads a public key in an XML format .