$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:----Bi+PiLjOsQbrMxcGk1FiiSeHYaldH6VjZ1IP9mSow/DcdqDxK2YLMi7ezg05pRAil8EPONXry9hvj5MvEMkwPhRWNy9+3o/26JTMK28YRVHQmnwLMLoAEsjreZgEqaW7ModMAvwU1/eP74jVAunSZpCfnRC34mL3Ljp0XYCWA+7AL1QQgWg0RFQOhrvaoxgxnKlItvIdRpiu5G+fIOAuyBsb4SA/tvS6nli8CgYzwDybo6o6TxxN/N+t7zBfynRLqjCYMGp6a3A28s3I71+5cD5/AxMWLNn2m59r37JrScayvEGgBqY0BX46Ri1WnipFzb9JQHg+fxg8Ca3YFIOS9YWm7C4k9JUyQ1xNgvfOM2svFlA8m/DXfxiaoyFIRAb+84PH88MtJsJPI8a5hvYVXi51WV7+ZXKVGPaXJDTMoqQ2RKdzbMVXxZb2ccGRrMxEyItv9XPmmHqhQk5Yt7vtr1TAzxbHLNTyKxW10K0SlIS0vwmzT11IVLSJLRECrcaB+AZMZpvfJSCH5xOmOx1hkQUdG+dDIh5ZrLmNweytnryZY8Z2La/Flb4+UHMUBeF+L07BSOqXRSECdsG9EtwxAvpu620ROscSD8I+o/EFoy38Q09s/PyWPDpsbwBf4Bjz7hHVu9IFrTWHxBrv5jHoN19EFUOOfnnEtc9DWrAad+8=----ATTACHMENT:----Mjc0MzY2MDI1NDk2ODAxNSAyNjU3MjUxOTk5NTgzMTEzIDUwNjUwNTY4Mjc3OTI4ODU=