Code Duplication    Length = 12-12 lines in 2 locations

src/Providers/AbstractProvider.php 1 location

@@ 441-452 (lines=12) @@
438
     *
439
     * @return \Overtrue\Socialite\AccessTokenInterface
440
     */
441
    protected function parseAccessToken($body)
442
    {
443
        if (!is_array($body)) {
444
            $body = json_decode($body, true);
445
        }
446
447
        if (empty($body['access_token'])) {
448
            throw new AuthorizeFailedException('Authorize Failed: '.json_encode($body, JSON_UNESCAPED_UNICODE), $body);
449
        }
450
451
        return new AccessToken($body);
452
    }
453
454
    /**
455
     * Get the code from the request.

src/Providers/DouYinProvider.php 1 location

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