Completed
Push — master ( 881b8c...5e1f80 )
by Iurii
01:21
created

Google   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A authorize() 0 10 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
use gplcart\modules\social_login\handlers\Base as BaseHandler;
13
14
/**
15
 * Contains methods for authorization with Google+
16
 */
17
class Google extends BaseHandler
18
{
19
20
    /**
21
     * Constructor
22
     */
23
    public function __construct()
24
    {
25
        parent::__construct();
26
    }
27
28
    /**
29
     * Process Google+ authorization
30
     * @param array $params
31
     * @param array $provider
32
     * @return mixed
33
     */
34
    public function authorize(array $params, array $provider)
35
    {
36
        $user = $this->request($params, 'https://www.googleapis.com/oauth2/v2/userinfo');
37
38
        if (!empty($user['verified_email'])) {
39
            return $this->submitUser($user, $provider);
40
        }
41
42
        return array();
43
    }
44
45
}
46