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

DokeopResourceOwner   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 0
dl 0
loc 69
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 2
A getFirstName() 0 4 2
A getLastName() 0 4 2
A getEmail() 0 4 1
A toArray() 0 4 1
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