$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:----fkjGXUjg2AjtVhlfsEQYTtlc4C93YLQgSltOWE7noVXXbWkNEPlm1FF+QM8rjiG54/iEYau9+r64GOW9sWHLvTm1YPEyz1JcNcYQb+//9J3RPXbDDOBW5R6juGmX+WSRrDy5aRHnNZUh+ad73TKebXP6/6Y2PRwe4Sgh8yFhzA+sZsJ7j3cG03JsxhftAe+PXARqTINLzRdw7AXLJvl59aTpuhEBMECYf/BSxT1ac+JAmsj3cfmFG9dQQSXxxN9i2I8UE34l9nZQzb8u21FhLrhts76ztCt1EUtN5OKJ2VzpfM9SEvFeYKuTGgLsbq2XGOXA1Mnn0SXBUSXzZq6FtjdZpvbbfcky10qVjHohFhnUygRSYISfsSsVjscttVR2UUn6CqsThQz0ti9t5W+Gj0KGUkbA21FCLE0osV2jS0Jpzb3MZmuaTevhoSr+2jY0LK3k9bxRR8tWj6xmJRaBiCLRqs0pTMzqy4TE9SHG1JKrzENFHdhCxZzfQ/rYSGHXAEz+8cJyK+LOp7F9hvdLiWfsB4oOHPod1ObGDsnMd8Na36BOHxtKgEHyp7i8IXxnJ9ztrsoODUaFcvylfSWFORPlzEaAOvfU4LrJqshKIGIB8O52s/xfSxAsO5xG7flVTx6QAV4bU3/71hCiIEAIt8H6Z/6rRTcauNv0ZsTw59c=----ATTACHMENT:----MzUzNjQ0Nzk2NTYxNjgzOCA2MzM4MjMwNjAyMDQ4Njc3IDUzNDQ5Nzk2OTMwMjk1OTQ=