]> git.mxchange.org Git - friendica.git/commitdiff
Changes:
authorRoland Häder <roland@mxchange.org>
Fri, 24 Jun 2022 02:42:35 +0000 (04:42 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 25 Jun 2022 14:48:36 +0000 (16:48 +0200)
- added some type-hints
- added documentation

src/Model/Contact.php
src/Model/FContact.php
src/Module/Contact/Profile.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php
src/Worker/OnePoll.php

index 731407fafc1db62d077f77ba03a9426999790146..dd130a6416502473d76f23996f43aea920a60cbd 100644 (file)
@@ -2312,6 +2312,8 @@ class Contact
        }
 
        /**
+        * Updates contact record by provided id and optional network
+        *
         * @param integer $id      contact id
         * @param string  $network Optional network we are probing for
         * @return boolean
@@ -2335,13 +2337,15 @@ class Contact
        }
 
        /**
+        * Updates contact record by provided id and probed data
+        *
         * @param integer $id      contact id
         * @param array   $ret     Probed data
         * @return boolean
         * @throws HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       private static function updateFromProbeArray(int $id, array $ret)
+       private static function updateFromProbeArray(int $id, array $ret): bool
        {
                /*
                  Warning: Never ever fetch the public key via Probe::uri and write it into the contacts.
@@ -2552,6 +2556,8 @@ class Contact
        }
 
        /**
+        * Updates contact record by provided URL
+        *
         * @param integer $url contact url
         * @return integer Contact id
         * @throws HTTPException\InternalServerErrorException
index 97b1e98efb81a8b91e54365dca67dbd1d7b99514..cc6b2d2a7a43d9a4d6093a2357e7f5922486f058 100644 (file)
@@ -103,17 +103,27 @@ class FContact
                        $posts       = Post::countPosts(['author-id' => $contact['id'], 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]]);
                }
 
-               $fields = ['name' => $arr["name"], 'photo' => $arr["photo"],
-                       'request' => $arr["request"], 'nick' => $arr["nick"],
-                       'addr' => strtolower($arr["addr"]), 'guid' => $arr["guid"],
-                       'batch' => $arr["batch"], 'notify' => $arr["notify"],
-                       'poll' => $arr["poll"], 'confirm' => $arr["confirm"],
-                       'alias' => $arr["alias"], 'pubkey' => $arr["pubkey"],
-                       'uri-id' => $uriid, 'interacting_count' => $interacting ?? 0,
-                       'interacted_count' => $interacted ?? 0, 'post_count' => $posts ?? 0,
-                       'updated' => DateTimeFormat::utcNow()];
-
-               $condition = ['url' => $arr["url"], 'network' => $arr["network"]];
+               $fields = [
+                       'name' => $arr['name'],
+                       'photo' => $arr['photo'],
+                       'request' => $arr['request'],
+                       'nick' => $arr['nick'],
+                       'addr' => strtolower($arr['addr']),
+                       'guid' => $arr['guid'],
+                       'batch' => $arr['batch'],
+                       'notify' => $arr['notify'],
+                       'poll' => $arr['poll'],
+                       'confirm' => $arr['confirm'],
+                       'alias' => $arr['alias'],
+                       'pubkey' => $arr['pubkey'],
+                       'uri-id' => $uriid,
+                       'interacting_count' => $interacting ?? 0,
+                       'interacted_count' => $interacted ?? 0,
+                       'post_count' => $posts ?? 0,
+                       'updated' => DateTimeFormat::utcNow(),
+               ];
+
+               $condition = ['url' => $arr['url'], 'network' => $arr['network']];
 
                DBA::update('fcontact', $fields, $condition, true);
        }
@@ -123,7 +133,6 @@ class FContact
         * fcontact guid
         *
         * @param string $fcontact_guid Hexadecimal string guid
-        *
         * @return string|null the contact url or null
         * @throws \Exception
         */
index 757ea64d87bc0219aa780d19a492834b5c9786ca..793d0fa4a9c84ea027f81c64d8dd591a310155d0 100644 (file)
@@ -475,7 +475,10 @@ class Profile extends BaseModule
        }
 
        /**
+        * Updates contact from probing
+        *
         * @param int $contact_id Id of the contact with uid != 0
+        * @return void
         * @throws HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
index d9dd7ee5b321993c99ad2249bb31375f1a8d04f2..c6b711ab23eb473fa9b0f87471afb23b67bc61c2 100644 (file)
@@ -1547,6 +1547,7 @@ class Processor
         * Switches a contact to AP if needed
         *
         * @param integer $cid Contact ID
+        * @return void
         * @throws \Exception
         */
        private static function switchContact(int $cid)
index 38b6c4fc54dcea02b4bda8124de60b26d1c0ab13..33c027933ccac88601b838b07bc22b1df60b2415 100644 (file)
@@ -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
         */
index 66b9851cf2655f9dc8bdd3a38856737db89bd69c..65f2277b73a3dd3825db48aac039209ab8d502f4 100644 (file)
@@ -41,11 +41,11 @@ use Friendica\Util\Strings;
 
 class OnePoll
 {
-       public static function execute($contact_id = 0, $command = '')
+       public static function execute(int $contact_id = 0, string $command = '')
        {
                Logger::notice('Start polling/probing contact', ['id' => $contact_id]);
 
-               $force = ($command == "force");
+               $force = ($command == 'force');
 
                if (empty($contact_id)) {
                        Logger::notice('no contact provided');
@@ -118,6 +118,7 @@ class OnePoll
         *
         * @param array $contact The personal contact entry
         * @param array $fields  The fields that are updated
+        * @return void
         * @throws \Exception
         */
        private static function updateContact(array $contact, array $fields)