Completed
Push — master ( 5e1f80...401c7c )
by Iurii
01:15
created

Google::authorize()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
/**
4
 * @package Social Login
5
 * @author Iurii Makukh <[email protected]>
6
 * @copyright Copyright (c) 2015, Iurii Makukh
7
 * @license https://www.gnu.org/licenses/gpl.html GNU/GPLv3
8
 */
9
10
namespace gplcart\modules\social_login\handlers;
11
12
/**
13
 * Contains methods for authorization with Google+
14
 */
15
class Google extends Provider
16
{
17
    /**
18
     * Process Google+ authorization
19
     * @param array $params
20
     * @param array $provider
21
     * @return mixed
22
     */
23
    public function authorize(array $params, array $provider)
24
    {
25
        $user = $this->request($params, 'https://www.googleapis.com/oauth2/v2/userinfo');
26
27
        if (!empty($user['verified_email'])) {
28
            return $this->submitUser($user, $provider);
29
        }
30
31
        return array();
32
    }
33
34
}
35