Completed
Push — master ( aef04b...0c132b )
by Patrick
01:11
created

AppleResourceOwner   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 77
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttribute() 0 4 1
A getFirstName() 0 4 1
A getId() 0 4 1
A getLastName() 0 4 1
A getEmail() 0 4 1
A toArray() 0 4 1
1
<?php namespace League\OAuth2\Client\Provider;
2
3
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
4
5
/**
6
 * @property array $response
7
 * @property string $uid
8
 */
9
class AppleResourceOwner extends GenericResourceOwner
10
{
11
12
    use ArrayAccessorTrait;
13
14
    /**
15
     * Raw response
16
     *
17
     * @var array
18
     */
19
    protected $response = [];
20
21
    /**
22
     * @var string|null
23
     */
24
    private $email;
25
26
    /**
27
     * Gets resource owner attribute by key. The key supports dot notation.
28
     *
29
     * @return mixed
30
     */
31
    public function getAttribute($key)
32
    {
33
        return $this->getValueByKey($this->response, (string) $key);
34
    }
35
36
    /**
37
     * Get user first name
38
     *
39
     * @return string|null
40
     */
41
    public function getFirstName()
42
    {
43
        return $this->getAttribute('name')['firstName'];
44
    }
45
46
    /**
47
     * Get user user id
48
     *
49
     * @return string|null
50
     */
51
    public function getId()
52
    {
53
        return $this->resourceOwnerId;
54
    }
55
56
    /**
57
     * Get user last name
58
     *
59
     * @return string|null
60
     */
61
    public function getLastName()
62
    {
63
        return $this->getAttribute('name')['lastName'];
64
    }
65
66
    /**
67
     * Get user email, if available
68
     *
69
     * @return string|null
70
     */
71
    public function getEmail()
72
    {
73
        return $this->getAttribute('email');
74
    }
75
76
    /**
77
     * Return all of the owner details available as an array.
78
     *
79
     * @return array
80
     */
81
    public function toArray()
82
    {
83
        return $this->response;
84
    }
85
}
86