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:----LLg3URoB1LhtC2yrowEH39BMhnjm7p5s0AL6jPOCYLzQ6x8p/ndpSsSdNTcge4o7KhouPWgquuQDJPmSBM4HvH/a7xbT/92c+9PH0Ymn4Ot/ay4cX3O2BSJOBR9gzXdUGftQT9h+ERnwEbUmxKF/qBI8VhRUylANCecAPd7wXosNmR6yHAR4svCG6T0D54eSUmlucRdpShbcvTM03KRaZ8UgjDw2wP/Zg/8I/BTIdx4z8RAQK1iXG77wNfLbMQ1LAj7Oj5icKm2SPP3l6DKpYTJTNzZXgaqXijdXFCUJla7KO7mDz+W2ItM/rVRF5zo/D2sW3OuSatoCyAisGq6eDoRsrEM9rYxk29SEHw9MCdwked+XfnTYZwAms6+pfw479L5+uXP+PQpUIXoo2apdot31B9Tu1JpPhuKU43hrwYVJUv2IPozdIfl1Ma2yFwtkm/hfeMEC+rUpRO7ssUmiSQCBYMn9ZLLiWQLS8K5buytofDKhCp/EgagN5xcd/waNvsXfmFKMiuVfeaNmKDdpjUBDhCRC53OcyCOBmF+5KUyKNfwnqJbzJB62JUwq5zc/K+LbfnVstEiF2DIE1PiR7cqpQYdkaWRxK0pOQN3WkOMcF7tdMBAv7Kpm3d0hN1HUS79G4EBawE9KajAryxSQoj3HHxe0pvCZ4kK3AUCBBYQ=----ATTACHMENT:----NTY5OTgxMTgzNDQxNzUwMCAyODczNDMwNjU3OTgzMzY0IDk1ODE4NjAzNzcxMDYzMzg=