ResourceOwner::getPicture()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
1
<?php
2
/**
3
 * Preview Technologies OAuth2 Resource Owner PHP class
4
 *
5
 * @author Shaharia Azam <[email protected]>
6
 * @url https://www.previewtechs.com
7
 */
8
9
namespace Previewtechs\Oauth2\Client;
10
11
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
12
13
/**
14
 * Class ResourceOwner
15
 * @package Previewtechs\Oauth2\Client
16
 */
17
class ResourceOwner implements ResourceOwnerInterface
18
{
19
20
    /**
21
     * @var array
22
     */
23
    protected $response;
24
25
    /**
26
     * ResourceOwner constructor.
27
     * @param array $response
28
     */
29
    public function __construct(array $response = array())
30
    {
31
        $this->response = $response;
32
    }
33
34
35
    /**
36
     * @return null
37
     */
38
    public function getId()
39
    {
40
        return $this->response['id'] ?: null;
41
    }
42
43
    /**
44
     * @return null
45
     */
46
    public function getEmail()
47
    {
48
        return $this->response['email_address'] ?: null;
49
    }
50
51
    /**
52
     * @return null
53
     */
54
    public function getFirstName()
55
    {
56
        return $this->response['profile']['first_name'] ?: null;
57
    }
58
59
    /**
60
     * @return null
61
     */
62
    public function getLastName()
63
    {
64
        return $this->response['profile']['last_name'] ?: null;
65
    }
66
67
    /**
68
     * @return null
69
     */
70
    public function getFullName()
71
    {
72
        return $this->response['profile']['full_name'] ?: null;
73
    }
74
75
    /**
76
     * @return null
77
     */
78
    public function getPicture()
79
    {
80
        return $this->response['profile']['picture'] ?: null;
81
    }
82
83
    /**
84
     * @return null
85
     */
86
    public function getGender()
87
    {
88
        return $this->response['profile']['gender'] ?: null;
89
    }
90
91
    /**
92
     * @return array
93
     */
94
    public function toArray()
95
    {
96
        return $this->response;
97
    }
98
}
99