Exemplo n.º 1
0
 /**
  * Builds an AccessToken object from an XML string.
  * @param string $data
  */
 public static function fromXml($data)
 {
     $dom = new DOMDocument();
     $parseOk = false;
     $parseOk = $dom->loadXML($data);
     if (!$parseOk) {
         throw new EsuException('Failed to parse Policy XML');
     }
     $accessToken = new AccessToken();
     $root = $dom->firstChild;
     if ($root->localName != 'access-token') {
         throw new EsuException('Expected root node to be \'access-token\'.  It was ' . $root->localName);
     }
     $accessToken->loadFromElement($root);
     return $accessToken;
 }