]> git.mxchange.org Git - friendica.git/commitdiff
Reduce cyclomatic complexity in APContact::getByURL()
authorArt4 <art4@wlabs.de>
Wed, 25 Dec 2024 18:21:27 +0000 (18:21 +0000)
committerArt4 <art4@wlabs.de>
Wed, 25 Dec 2024 18:21:27 +0000 (18:21 +0000)
src/Model/APContact.php

index 10534498ac71afb649db9b99510b0213cf9964ea..9042f3e31916d612cc2012cbf2a09924bfadeb79 100644 (file)
@@ -207,6 +207,15 @@ class APContact
                        return $fetched_contact;
                }
 
+               return self::compactProfile($apcontact, $compacted, $url, $fetched_contact, $webfinger, $local_owner);
+       }
+
+       /**
+        * @param array|bool $fetched_contact
+        * @param array|bool $local_owner
+        */
+       private static function compactProfile(array $apcontact, array $compacted, string $url, $fetched_contact, bool $webfinger, $local_owner): array
+       {
                $apcontact['url'] = $compacted['@id'];
                $apcontact['uuid'] = JsonLD::fetchElement($compacted, 'diaspora:guid', '@value');
                $apcontact['type'] = str_replace('as:', '', JsonLD::fetchElement($compacted, '@type'));