]> git.mxchange.org Git - friendica-addons.git/commitdiff
[twitter] Fix return value of twitter_user_to_contact()
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 21 Jun 2020 20:33:18 +0000 (16:33 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 21 Jun 2020 20:33:18 +0000 (16:33 -0400)
- Simplify check in twitter_fetch_own_contact()

twitter/twitter.php

index ff773c0a32682f34e3586aa4921026f0d7a139ef..15ad9b579d468c404311bbf206404ac3e39c9af6 100644 (file)
@@ -1079,10 +1079,14 @@ function twitter_get_relation($uid, $target, $contact = [])
        return $relation;
 }
 
+/**
+ * @param $data
+ * @return array
+ */
 function twitter_user_to_contact($data)
 {
        if (empty($data->id_str)) {
-               return -1;
+               return [];
        }
 
        $baseurl = 'https://twitter.com';
@@ -1924,7 +1928,7 @@ function twitter_fetch_own_contact(App $a, $uid)
                // Fetching user data
                // get() may throw TwitterOAuthException, but we will catch it later
                $user = $connection->get('account/verify_credentials');
-               if (empty($user) || empty($user->id_str)) {
+               if (empty($user->id_str)) {
                        return false;
                }