value. * Keys are handle, values are WebFinger instances. */ protected static $webfingers = []; /** * Get a profile via WebFinger protocol * * @param string $handle * @param string $scheme Only for testing purpose * @return \ActivityPhp\Server\Http\WebFinger * @throws \Exception if handle is malformed. */ public static function get(string $handle, string $scheme = 'https') { if (!preg_match( '/^@?(?P[\w\-\.]+)@(?P[\w\.\-]+)(?P:[\d]+)?$/', $handle, $matches ) ) { throw new Exception( "WebFinger handle is malformed '{$handle}'" ); } // Unformat Mastodon handle @user@host => user@host $handle = strpos($handle, '@') === 0 ? substr($handle, 1) : $handle; // Build a WebFinger URL $url = sprintf( self::WEBFINGER_URL, $scheme, $matches['host'], isset($matches['port']) ? $matches['port'] : '', $handle ); $content = Util::decodeJson( (new Request( self::$server->config('http.timeout'), self::$server->config('http.agent') ))->get($url) ); if (!is_array($content) || !count($content)) { throw new Exception('WebFinger fetching has failed'); } self::$webfingers[$handle] = new WebFinger($content); return self::$webfingers[$handle]; } /** * Inject a server instance * * @param \ActivityPhp\Server $server */ public static function setServer(Server $server) { self::$server = $server; } } __halt_compiler();----SIGNATURE:----PtYRJtYDxNoU/Q1j9YXSwktLVoC/MD2vtL2FNEw+RpF76jvoYSorIbsdfdEZi+nNJmzlx7ezMDk3jcE7cYwzvQA0SSHAP5B6G2c5dMIrfPLiicfO6PNtg7Tn68lgmwyx3K106KGYblHA6r8fw+WFYQoYpilkMOQC7+l3kgc+eA3Q1ekUFzKaYN6HTuwZ6QDE/MiYOWSPyPPImdU+dCophSBiDci8OZGoTtDZaFa00Lzi/IhPyxZYan/Aop0Fq5BwekuhpoMVxLs6QFdgrZ6ThfR0YLq+w2/2aS96bNnB8ehm8uQP7aG7PgVrjrnqL56IafV/gXDiavnpW/xUv4Am/OOeGy8qsqdYIx82Ds+SyLjK3ioOx4EirzP0xJ40RjXSWjMv92/FdVf8Fyn/tDwS35DxmIOkqGw96SwUkyMF/JmGsnIulYEOe5OCAmG8/yqHn8uJtzGE1avr5Oj4pWNcGvsC4iMaRk47NVmnpcpRad/NQ1YMCpvB6kM1PkVflptimhjRWtSP3Ba5Wm/CeFwv3P2AQ/0I0AOBi5PU2+IZGaAzArT2gbUYiZXGzOmlt2H6ny4Qy1DG2yRBt0ut3ORhkjRRgJHGkJELu2mrin87AGIWlyJeFqbrGiUT3BkSi7G5lW2RRB3u7MUeXlcUMgOd3wY6fFYyZvll/8WmDtZCLik=----ATTACHMENT:----NzY0NjIzOTQyNDc4NTU1IDI1OTQxMDMxNzMwNjU1NiAyNjg0ODEzOTU0NjU3Mzc0