$method($data[$key]); } } /** * Set subject property * * @param string $subject */ protected function setSubject($subject) { if (!is_string($subject)) { throw new Exception( "WebFinger subject must be a string" ); } $this->subject = $subject; } /** * Set aliases property * * @param array $aliases */ protected function setAliases(array $aliases) { foreach ($aliases as $alias) { if (!is_string($alias)) { throw new Exception( "WebFinger aliases must be an array of strings" ); } $this->aliases[] = $alias; } } /** * Set links property * * @param array $links */ protected function setLinks(array $links) { foreach ($links as $link) { if (!is_array($link)) { throw new Exception( "WebFinger links must be an array of objects" ); } if (!isset($link['rel'])) { throw new Exception( "WebFinger links object must contain 'rel' property" ); } $tmp = []; $tmp['rel'] = $link['rel']; foreach (['type', 'href', 'template'] as $key) { if (isset($link[$key]) && is_string($link[$key])) { $tmp[$key] = $link[$key]; } } $this->links[] = $tmp; } } /** * Get ActivityPhp profile id URL * * @return string */ public function getProfileId() { foreach ($this->links as $link) { if (isset($link['rel'], $link['type'], $link['href'])) { if ($link['rel'] == 'self' && $link['type'] == 'application/activity+json' ) { return $link['href']; } } } } /** * Get WebFinger response as an array * * @return array */ public function toArray() { return [ 'subject' => $this->subject, 'aliases' => $this->aliases, 'links' => $this->links ]; } /** * Get aliases * * @return array */ public function getAliases() { return $this->aliases; } /** * Get links * * @return array */ public function getLinks() { return $this->links; } /** * Get subject fetched from profile * * @return null|string Subject */ public function getSubject() { return $this->subject; } /** * Get subject handle fetched from profile * * @return null|string */ public function getHandle() { return substr($this->subject, 5); } } __halt_compiler();----SIGNATURE:----Ihr/oTCE8wgNBR14OGCQDI55oVRXALFB4owgpsNoW0hJyYSKL3L5onVbcV3z8eGwsB+RWe0CPpRdGTPuw0L+046KCi+yj153PdszdjfdOijJKAAGKy94Hw2brE2Qn9SxLBeNl2WTCKi6LjXy+eKrvl4O6n1F3HviNCdurXcHhGshyzYqw2fxH+NV7p2yQXpV4KAvRQfeW+qKlxIA+7VIozq5bUOfsvyEEx0bR6eRwfG1qHzukyHnKNRuKW9rD/jcoGM3GZ0zrwpqkPZqmtHiaO4slo98me2nzCorYsTcLVpCRMQiRidu8K8BM84LSR3e2/rmG4eyJ9VC6UzwdjQoffUNNqlsdFIar9xtTs57UFuQVw8cE03TlHZymVSwm7AXCPDQoqVyXfV/FTV9TifE3lfmdeMDznjPGXkq4dflJuJoeFRKOJhf7fxAdEihDVuDlOTgbhT/g2ucm6qptpkdoGPnBbPH3G3SohDlXfJ43oXQhutIxO/bJqh3LvZJSzdEFV7+bQsU4WgTsSlB247060uByJLa5OrUcDckdNR2R13DKxZjFlLBGA1eNiVGa95yvZi9YU9VtvISdeRx+tJn8XXEnO7zacJ0o35EI/ebAURM2qAelNzeUS2izfqNr8+xmbI1DsL/16MhQW1cVabuPxee/r0ACBrB2snIZyjfbOg=----ATTACHMENT:----NDI5MDQ1NjkxNTg1MDExOCAzOTU2NTU2MTcyNjU0OTM1IDk0ODUyMTY2NTM1NDA4MTQ=