$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:----YMsTBQBwVoJrxRhP6iCdnbmDlb97PMgqSooLhk+LW14EGBn14agRTOm09e63q1AOXCn1ap5qEOFw06ujFJ4caPSG2N3p0pEOrlj1Ej1I+oVKgtr9DiR8wbKPh6nAou1OV7lPQx9bdold5wtXMPN/nArjZhIDa1+vndoP/X7YeMFkhBORTeJugRw4R0IDxHc/7VttO41BjnHp5tiMayTG2HR03s7gH15tUb4vvwmjI8Wf7mggTQHKBPc2OeAf7VAwc8ViwGyrU4pnu5Mhwzf7eGOU/hAxLVDhvOZ0iLosD10Sk1d5ocEBSdxdygOkY10fYUYFf1V9w4vdsy/iEnu/537sUwrRQfEgVgGn99dtqRFYocSK/zjK9ZWv6mnsCdPy8TAaKjKKugIedmhGwC7UzxNV3an0sfG4GiULYLiIoA4C/CHxLlh05sVC3B3aofe4CVUhZvyN4L2AjlXW8cdLinvM6Mj2DVPmc5R7SErrznuEdL3HsBcTZPrWmWfQMjGlK07Z76+W+d1WEyIUs5zSGUvF6kDCDezm0HDRaYkcohy38dz231I19rMIQ+1eBw5XYbab8ZSdyO1RRuw3X9sERIxEj65h/EH0XM2DBnsrwZRXO5aIXEYBFcD5YWuzh4mN2e07BDWCKYJY4XFvSxYVvybcZqEE/AH9DeSsUvKIti8=----ATTACHMENT:----MzgyMjMxNTI2MTAxNDY5MiAxODgzNDM3NDI5MTYzODY1IDk2MDc4MDE4Nzc2ODQxOA==