コード例 #1
0
 /**
  * @return \Spark\Auth\Credentials
  */
 public function getCredentials()
 {
     $cred_node = $this->dom->querySelector('credentials');
     $username = $cred_node->getAttribute('username');
     $password = $cred_node->getAttribute('password');
     if ($username && !is_null($password)) {
         return new Credentials($username, $password);
     } else {
         throw new Exception("No credentials set.");
     }
 }
コード例 #2
0
 function testCanQueryXML()
 {
     $doc = new DOMDocument();
     $doc->loadXML($this->xmlCode);
     $dom = new DOMSelector($doc, false);
     // pull out data from XML
     $arr['email'] = $dom->querySelector('user > email')->nodeValue;
     $arr['name'] = $dom->querySelector('user > username')->nodeValue;
     $arr['apiKey'] = $dom->querySelector('user attribute[id=api_key]')->nodeValue;
     $arr['posId'] = (int) $dom->querySelector('user attribute[id=pos_id]')->nodeValue;
     $this->assertEquals("*****@*****.**", $arr['email']);
     $this->assertEquals("steve", $arr['name']);
     $this->assertEquals("a983ci47dsnuc9xw42", $arr['apiKey']);
     $this->assertEquals(1833, $arr['posId']);
 }
コード例 #3
0
 protected function getTokenNodes()
 {
     $dom = new DOMSelector($this->document, false);
     return $dom->querySelectorAll('token');
 }