Code Duplication    Length = 5-5 lines in 3 locations

app/Models/SocialAuth.php 1 location

@@ 136-140 (lines=5) @@
133
     */
134
    public static function findByUser($userId, $social = null)
135
    {
136
        if (is_object($userId)) {
137
            $userId = $userId->id;
138
        } elseif (is_array($userId)) {
139
            $userId = $userId['id'];
140
        }
141
142
        $query = static::where('user_id', $userId);
143

app/Support/helpers.php 1 location

@@ 94-98 (lines=5) @@
91
     */
92
    function get_id($var, $key = 'id')
93
    {
94
        if (is_object($var)) {
95
            return $var->{$key};
96
        } elseif (is_array($var)) {
97
            return $var[$key];
98
        }
99
100
        return $var;
101
    }

app/Support/Tencent/XgPusher.php 1 location

@@ 238-242 (lines=5) @@
235
            return $user;
236
        }
237
238
        if (is_object($user)) {
239
            $user = $user->id;
240
        } elseif (is_array($user)) {
241
            $user = $user['id'];
242
        }
243
244
        return $this->accountPrefix.$user;
245
    }