$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:----xOjNqJUovHNCwMGipPLvgJBtusNEZIouvek0jCvA2fRHIhyBv51GtVlbSXn43jPN8AHnpSo3r35FtaVX9+bbfAZgGtEHdwqBrfNkIQtS+rpX2TjkdvFMpOFsNYYU+KbkQqx0rONE7DSDewgnok/ed+tnBQIeK9MXm0oleqxlSYOSOxYR8CpKa2s2bfsqGCet/DC4kqJCawSc2vPMXuWj2x0D6IVLUXFSpW+nKkmx1FbaDSACzeHoEp05XH29bOLOKCmlMGFEO67Apk2KpqVocMRawLfctu6vo0t/X/tQChjg56Z1KDEpDZa+WCsx1ZSYjlo1iCi0K4mZZOYr5F3BD5kNFHNPRqkTR9HHU86YkvK3dD77c9u1iSD5ZvHGGQjr1OopjPUaMnYdA+iPxc4/uAOQwe7vbR6zTfgC+u9qOO5FK9X3D6fJjFEqCg5TLRfFIxPLohEJn/8f2P7J4t+lnb9GjHAJCHPN3jEntfI0tzw8L0cFUPRp2Esg4XKo7xZRmnbr3WfP+RRaVDg1AvKBa9n9MXGwfIc15Ru+14AhYGeEO77KPqmzShSPSnZdlzj/utKL+aDNSy7o304w6hFt8WDwAAAjLkxKxBeUTl5anhsN44rPQ2qfV2pxkLtR+j1wYRt2MwVEXGcEP/e2Z2Jk/GCAVx2Nz7uY+2nqO0M8ZMQ=----ATTACHMENT:----Mjk2MjcxNzU3NTE2NjgyMCA3NTA5MTY3NDI1NzM0NzAwIDY0NzkxNjAyMjE4MDU2MzY=