BoxResourceOwner::getAvatarUrl()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

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