Completed
Push — master ( e15dda...b3766a )
by Vincent
01:34
created

DokeopResourceOwner::getFirstName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
namespace Dokeop\OAuth2\Client\Provider;
3
4
class DokeopResourceOwner implements ResourceOwnerInterface
5
{
6
    /**
7
     * Raw response.
8
     *
9
     * @var array
10
     */
11
    protected $response;
12
13
    /**
14
     * Creates new resource owner.
15
     *
16
     * @param array $response
17
     */
18
    public function __construct(array $response)
19
    {
20
        $this->response = $response;
21
    }
22
23
    /**
24
     * Returns the identifier of the authorized resource owner.
25
     *
26
     * @return int|null
27
     */
28
    public function getId()
29
    {
30
        return $this->response['id'] ?: null;
31
    }
32
33
    /**
34
     * Returns resource owner first name.
35
     *
36
     * @return string|null
37
     */
38
    public function getFirstName()
39
    {
40
        return $this->response['first_name'] ?: null;
41
    }
42
43
    /**
44
     * Returns resource owner last name.
45
     *
46
     * @return string|null
47
     */
48
    public function getLastName()
49
    {
50
        return $this->response['last_name'] ?: null;
51
    }
52
53
    /**
54
     * Returns resource owner email.
55
     *
56
     * @return bool
57
     */
58
    public function getEmail()
59
    {
60
        return $this->response['email'];
61
    }
62
63
    /**
64
     * Returns all of the owner details available as an array.
65
     *
66
     * @return array
67
     */
68
    public function toArray()
69
    {
70
        return $this->response;
71
    }
72
}
73