From 6684f0d5c77ab257f3fcae450cdb4fe9aea312e7 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 25 Dec 2024 18:21:27 +0000 Subject: [PATCH] Reduce cyclomatic complexity in APContact::getByURL() --- src/Model/APContact.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 10534498ac..9042f3e319 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -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')); -- 2.39.5