Code Duplication    Length = 12-12 lines in 2 locations

src/Providers/DouYinProvider.php 1 location

@@ 116-127 (lines=12) @@
113
     *
114
     * @return \Overtrue\Socialite\AccessTokenInterface
115
     */
116
    protected function parseAccessToken($body)
117
    {
118
        if (!is_array($body)) {
119
            $body = json_decode($body, true);
120
        }
121
122
        if (empty($body['data']['access_token'])) {
123
            throw new AuthorizeFailedException('Authorize Failed: '.json_encode($body, JSON_UNESCAPED_UNICODE), $body);
124
        }
125
126
        return new AccessToken($body['data']);
127
    }
128
129
    /**
130
     * 通过token 获取用户信息.

src/Providers/AbstractProvider.php 1 location

@@ 458-469 (lines=12) @@
455
     *
456
     * @return \Overtrue\Socialite\AccessTokenInterface
457
     */
458
    protected function parseAccessToken($body)
459
    {
460
        if (!is_array($body)) {
461
            $body = json_decode($body, true);
462
        }
463
464
        if (empty($body['access_token'])) {
465
            throw new AuthorizeFailedException('Authorize Failed: '.json_encode($body, JSON_UNESCAPED_UNICODE), $body);
466
        }
467
468
        return new AccessToken($body);
469
    }
470
471
    /**
472
     * Get the code from the request.