Code Duplication    Length = 21-21 lines in 2 locations

Oauth/Client/Client/TwitterOAuthClient.php 1 location

@@ 49-69 (lines=21) @@
46
        return $request_token['oauth_token'];
47
    }
48
49
    public function redirect(array $scopes = [], array $options = [], $token = null)
50
    {
51
        if (!empty($scopes)) {
52
            $options['scope'] = $scopes;
53
        }
54
55
        if ($token) {
56
            $options['token'] = $token;
57
        }
58
59
        $url = $this->provider->twitter->url(static::URL_AUTHORIZE, ['oauth_token' => $this->getRequestToken()]);
60
61
        if (!$this->isStateless) {
62
            $this->getSession()->set(self::OAUTH2_SESSION_STATE_KEY, $this->provider->getState());
63
        }
64
65
        return new RedirectResponse($url);
66
    }
67
68
    public function getAccessToken()
69
    {
70
        if (!$this->isStateless) {
71
            $expectedState = $this->getSession()->get(self::OAUTH2_SESSION_STATE_KEY);
72
            $actualState = $this->getCurrentRequest()->query->get('state');

Oauth/Client/OAuth2Client.php 1 location

@@ 34-54 (lines=21) @@
31
        $this->isStateless = true;
32
    }
33
34
    public function redirect(array $scopes = [], array $options = [], $token = null)
35
    {
36
        if (!empty($scopes)) {
37
            $options['scope'] = $scopes;
38
        }
39
40
        if ($token) {
41
            $options['token'] = $token;
42
        }
43
44
        $url = $this->provider->getAuthorizationUrl($options);
45
46
        if (!$this->isStateless) {
47
            $this->getSession()->set(self::OAUTH2_SESSION_STATE_KEY, $this->provider->getState());
48
        }
49
50
        return new RedirectResponse($url);
51
    }
52
53
    public function getAccessToken(array $attributes = [])
54
    {
55
        if (!$this->isStateless) {
56
            $expectedState = $this->getSession()->get(self::OAUTH2_SESSION_STATE_KEY);
57
            $actualState = $this->getCurrentRequest()->query->get('state');