GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

YahooUser::setImageURL()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace Hayageek\OAuth2\Client\Provider;
3
4
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
5
6
class YahooUser implements ResourceOwnerInterface
7
{
8
    /**
9
     * @var array
10
     */
11
    protected $response;
12
    
13
14
    /**
15
     * @var image URL
16
     */
17
    private $imageUrl;
0 ignored issues
show
Unused Code introduced by
The property $imageUrl is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
18
19
    /**
20
     * @param array $response
21
     */
22
    public function __construct(array $response)
23
    {
24
        $this->response = $response;
25
    }
26
27
    public function getId()
28
    {
29
        return $this->response['profile']['guid'];
30
    }
31
32
    /**
33
     * Get perferred display name.
34
     *
35
     * @return string
36
     */
37
    public function getName()
38
    {
39
        /*
40
        nickname is not coming in the response.
41
        $this->response['profile']['nickname']
42
        */
43
        return $this->getFirstName()." ".$this->getLastName();
44
    }
45
46
    /**
47
     * Get perferred first name.
48
     *
49
     * @return string
50
     */
51
    public function getFirstName()
52
    {
53
        return $this->response['profile']['givenName'];
54
    }
55
56
    /**
57
     * Get perferred last name.
58
     *
59
     * @return string
60
     */
61
    public function getLastName()
62
    {
63
        return $this->response['profile']['familyName'];
64
    }
65
66
    /**
67
     * Get email address.
68
     *
69
     * @return string|null
70
     */
71
    public function getEmail()
72
    {
73
        if (!empty($this->response['profile']['emails'])) {
74
            return $this->response['profile']['emails'][0]['handle'];
75
        }
76
    }
77
78
    /**
79
     * Get avatar image URL.
80
     *
81
     * @return string|null
82
     */
83
    public function getAvatar()
84
    {
85
        return $this->response['imageUrl'];
86
    }
87
88
    public function setImageURL($url)
89
    {
90
        $this->response['imageUrl'] = $url;
91
        return $this;
92
    }
93
94
    /**
95
     * Get user data as an array.
96
     *
97
     * @return array
98
     */
99
    public function toArray()
100
    {
101
        return $this->response;
102
    }
103
}
104