Exemplo n.º 1
0
 function query($xri, $service_types, $filters = array())
 {
     $services = array();
     $canonicalID = null;
     foreach ($service_types as $service_type) {
         $url = $this->queryURL($xri, $service_type);
         $response = $this->fetcher->get($url);
         if ($response->status != 200 and $response->status != 206) {
             continue;
         }
         $xrds = Auth_Yadis_XRDS::parseXRDS($response->body);
         if (!$xrds) {
             continue;
         }
         $canonicalID = Auth_Yadis_getCanonicalID($xri, $xrds);
         if ($canonicalID === false) {
             return null;
         }
         $some_services = $xrds->services($filters);
         $services = array_merge($services, $some_services);
         // TODO:
         //  * If we do get hits for multiple service_types, we're
         //    almost certainly going to have duplicated service
         //    entries and broken priority ordering.
     }
     return array($canonicalID, $services);
 }
Exemplo n.º 2
0
 function _getCanonicalID($iname, $xrds, $expectedID)
 {
     if ($expectedID === null) {
         $result = Auth_Yadis_getCanonicalID($iname, $xrds);
         if ($result !== false) {
             $this->fail($iname . ' (got ' . $result . ')');
         }
     } else {
         $cid = Auth_Yadis_getCanonicalID($iname, $xrds);
         $this->assertEquals(Auth_Yadis_XRI($expectedID), $cid);
     }
 }