Completed
Push — master ( c282cc...ad0f5e )
by Steven
01:53
created

InstagramResourceOwner::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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