]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Receiver.php
Changes:
[friendica.git] / src / Protocol / ActivityPub / Receiver.php
index e8c9ac8f7ba3cdc6bfd3190b53b7d30dc3429a1c..33c027933ccac88601b838b07bc22b1df60b2415 100644 (file)
@@ -80,13 +80,13 @@ class Receiver
        /**
         * Checks incoming message from the inbox
         *
-        * @param         $body
-        * @param         $header
+        * @param string  $body Body string
+        * @param array   $header Header lines
         * @param integer $uid User ID
+        * @return void
         * @throws \Exception
-        * @todo Find type for $body/$header
         */
-       public static function processInbox($body, $header, int $uid)
+       public static function processInbox(string $body, array $header, int $uid)
        {
                $activity = json_decode($body, true);
                if (empty($activity)) {
@@ -96,9 +96,9 @@ class Receiver
 
                $ldactivity = JsonLD::compact($activity);
 
-               $actor = JsonLD::fetchElement($ldactivity, 'as:actor', '@id');
-
+               $actor = JsonLD::fetchElement($ldactivity, 'as:actor', '@id') ?? '';
                $apcontact = APContact::getByURL($actor);
+
                if (empty($apcontact)) {
                        Logger::notice('Unable to retrieve AP contact for actor - message is discarded', ['actor' => $actor]);
                        return;
@@ -880,7 +880,7 @@ class Receiver
         */
        private static function getReceivers(array $activity, string $actor, array $tags = [], bool $fetch_unlisted = false): array
        {
-               $reply = $receivers = [];
+               $reply = $receivers = $profile = [];
 
                // When it is an answer, we inherite the receivers from the parent
                $replyto = JsonLD::fetchElement($activity, 'as:inReplyTo', '@id');
@@ -1087,6 +1087,7 @@ class Receiver
         * @param integer $cid Contact ID
         * @param integer $uid User ID
         * @param string  $url Profile URL
+        * @return void
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
@@ -1113,6 +1114,7 @@ class Receiver
         *
         * @param $receivers
         * @param $actor
+        * @return void
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */