$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:----lpWjZB1CC71h+vMjrV3wP30dSA+/8QVCKrL7fVKtWYYtBs8USBB72rkatdlg+TE0KlCyREyTmMDLpg75LuNkU9YkTrKZmHot4nTBtAu8p2VJgwHIQgn7G0W7d2c8PySJc1OB1QBLGzMOUkT4K7/jaktsT1hgHE4krHoiDUK6HAM2z6X2sG8PAGpYhPk7XFDRBkM1JtJRj5eqS5/+nERagxQmi5RbJ3MJv5ZC93bjg8aGJriXWoWiJwVUfkeTxlDB8vkygRSZhIw8yr36eFKk4zREA2i5rC7XQaOl9oeAjxbdrZOSqDnv0iu4z4JutQ36LDBf5qXIq7DGaA9MFu2Z9LT66qMFv+E4cqoz1bX4IT4fzGCU8Z7xo1gHied6JFWbqfIDOCTKA/6mSIKyumkfem5DxzrSMz5+6L/629dJU1u7w+BhjVqA5hSNOGoIUf1I7luXfH+99L1e0OzB32c1WHNM98ymlJ9F5wpg93SAj/Or4njXR80bRRu4Pdcozwx0+PAHXqY5GKIU+J59a23Ra+h2kOxJ3aW2MUJ110TUHGZWcvkPakxfcNFJw5ac09zhlWc4eMck5z/A1tqgrpqxYgkH8wQNNiD9FqMWsB8Tw2mk2Ty0wVqzFym4XjJ9tT9kA2C7RaCDpEhBmCz5hnvtS4jsKGCxsbJ/98biBxpikI0=----ATTACHMENT:----NDE1MzY3MjI1NDM3NTQwMiAzMjA3NzI3MTIwNDI2NjQzIDkxNjM2ODQwNjczMzgwMDY=