$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:----bLuPH8FLpl5xodqYbxsF7+mDxsoYFxXOUaPi/+oMvomVB7pmh7/OWUdFHOgCHxA/TIPxNVjhd2PI69BRxlgEJK3mM2tOIt8Gec6OLpMMVXQBWMlVDKDrpN+EQ6KkdaU2B0vCmqnyarlDz4yS7DLfXK9BQgaAPxh7bqLvOds/5q3I6mv44G8n+3k0BXbIb6PMl6XY/bwOq95k4VJ8HDMtCmI//fn4V2XK0vG4bYy0u2I/yP697uN2cQAlyS8itkOlzy8V2c8MYDGFylCWbUnF7TMMJak+FBOJri7SL216n8USmDVUu0qlAvlgYUcOFeRYWuT0RZn5S9kHxDkjEwyvU9INbgC8ASK9SAebKVMQ2jzvwXeCpUJ/Na4/Cypse1ef/PROE/Mo++xjf3jV4BqVKKKI24VXePOY2+FMLg6ct+Kcm5mWmBztFOgy+gYfySxWWsDLlSP7yEd3ROlkhKfanvj73N05O9hYEg0NmQhry5S3Nq3w/Xhy6UPIai9vp48zsRSqCpHvh/a0zDwSnGjpzmbHMc+WdeVDMzX7KhtfWF2po6d7vAdSXozx+c/U6P9eo2wZpbdacDUjUf3cZ7taNPO+QUdV41wP6edARJ8iSk018Z9UA+xYNF/jeWn38jFIigw4Fbp2aM5D84V9yCe9A4ti+1vJqbpBxw/XFNG6oz8=----ATTACHMENT:----ODA2MDk0NTY5NDExMDkwMiAzNTYzMjk1NjYwMDkzMTM1IDY0NDk5ODkwOTI4OTk5MDg=