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

Facebook::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
/**
4
 * @package Social Login
5
 * @author Iurii Makukh <[email protected]>
6
 * @copyright Copyright (c) 2018, 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 Facebook
16
 */
17
class Facebook extends BaseHandler
18
{
19
20
    /**
21
     * Constructor
22
     */
23
    public function __construct()
24
    {
25
        parent::__construct();
26
    }
27
28
    /**
29
     * Process Facebook 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://graph.facebook.com/me', array('fields' => 'name,email'));
37
        return $this->submitUser($user, $provider);
38
    }
39
40
}
41