[LRDD] Add a new method for grabing profile aliases
This commit is contained in:
parent
a17c010bb9
commit
8b8157ce25
|
@ -65,4 +65,27 @@ class LRDDPlugin extends Plugin
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch all the aliases of some remote profile
|
||||||
|
*
|
||||||
|
* @param string $uri profile's URI
|
||||||
|
* @return array|null aliases
|
||||||
|
* @throws Exception (If the Discovery's HTTP requests fail)
|
||||||
|
* @author Bruno Casteleiro <brunoccast@fc.up.pt>
|
||||||
|
*/
|
||||||
|
public static function grab_profile_aliases(string $uri): ?array
|
||||||
|
{
|
||||||
|
$disco = new Discovery();
|
||||||
|
$xrd = $disco->lookup($uri);
|
||||||
|
|
||||||
|
$all_ids = array_merge([$xrd->subject], $xrd->aliases);
|
||||||
|
|
||||||
|
if (!in_array($uri, $all_ids)) {
|
||||||
|
$this->log(LOG_INFO, 'The original URI was not listed itself when doing discovery on it!');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $all_ids;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user