Code Duplication    Length = 10-10 lines in 2 locations

id/protocols/oauth2/providers/Bitbucket.php 1 location

@@ 87-96 (lines=10) @@
84
     * @param   oauth2\Token    $token  The Access Token to use.
85
     * @return  Promise                 A Promise for the entity's e-mail address.
86
     */
87
    protected function getEmail(oauth2\Token $token) : Promise
88
    {
89
        return $this->request('GET', 'https://api.bitbucket.org/2.0/user/emails', $token)->then(function(array $data) {
90
            foreach ($data['values'] as $email) {
91
                if ($email['is_primary'] && $email['is_confirmed']) {
92
                    return $email['email'];
93
                }
94
            }
95
        });
96
    }
97
98
    /**
99
     * {@inheritdoc}

id/protocols/oauth2/providers/Github.php 1 location

@@ 82-91 (lines=10) @@
79
     * @param   oauth2\Token    $token  The Access Token to use.
80
     * @return  Promise                 A Promise for the entity's e-mail address.
81
     */
82
    protected function getEmail(oauth2\Token $token) : Promise
83
    {
84
        return $this->request('GET', 'https://api.github.com/user/emails', $token)->then(function(array $data) {
85
            foreach ($data as $email) {
86
                if ($email['primary'] && $email['verified']) {
87
                    return $email['email'];
88
                }
89
            }
90
        });
91
    }
92
93
    /**
94
     * {@inheritdoc}