Code Duplication    Length = 5-5 lines in 2 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/Tencent/XgPusher.php 1 location

@@ 133-137 (lines=5) @@
130
     */
131
    public static function accountForUser($user)
132
    {
133
        if (is_object($user)) {
134
            $user = $user->id;
135
        } elseif (is_array($user)) {
136
            $user = $user['id'];
137
        }
138
139
        // 信鸽不允许使用简单的账号,例如纯数字的id。
140
        // 所以在 userId 前面加个 'user' 字符。