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.

DiscordResourceOwner::getVerified()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the wohali/oauth2-discord-new library
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright Copyright (c) Joan Touzet <[email protected]>
9
 * @license http://opensource.org/licenses/MIT MIT
10
 * @link https://packagist.org/packages/wohali/oauth2-discord-new Packagist
11
 * @link https://github.com/wohali/oauth2-discord-new GitHub
12
 */
13
14
namespace Wohali\OAuth2\Client\Provider;
15
16
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
17
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
18
19
class DiscordResourceOwner implements ResourceOwnerInterface
20
{
21
    use ArrayAccessorTrait;
22
23
    /**
24
     * Raw response
25
     *
26
     * @var array
27
     */
28
    protected $response;
29
30
    /**
31
     * Creates new resource owner.
32
     *
33
     * @param array  $response
34
     */
35 3
    public function __construct(array $response = array())
36
    {
37 3
        $this->response = $response;
38 3
    }
39
40
    /**
41
     * Get resource owner ID
42
     *
43
     * @return string|null
44
     */
45 3
    public function getId()
46
    {
47 3
        return $this->getValueByKey($this->response, 'id');
48
    }
49
50
    /**
51
     * Get resource owner username
52
     *
53
     * @return string|null
54
     */
55 3
    public function getUsername()
56
    {
57 3
        return $this->getValueByKey($this->response, 'username');
58
    }
59
60
    /**
61
     * Get resource owner discriminator
62
     *
63
     * @return string|null
64
     */
65 3
    public function getDiscriminator()
66
    {
67 3
        return $this->getValueByKey($this->response, 'discriminator');
68
    }
69
70
    /**
71
     * Get resource owner avatar hash
72
     *
73
     * @return string|null
74
     */
75 3
    public function getAvatarHash()
76
    {
77 3
        return $this->getValueByKey($this->response, 'avatar');
78
    }
79
80
    /**
81
     * Get resource owner verified flag
82
     *
83
     * @return bool
84
     */
85 3
    public function getVerified()
86
    {
87 3
        return $this->getValueByKey($this->response, 'verified', false);
88
    }
89
90
    /**
91
     * Get resource owner email
92
     *
93
     * @return string|null
94
     */
95 3
    public function getEmail()
96
    {
97 3
        return $this->getValueByKey($this->response, 'email');
98
    }
99
100
    /**
101
     * Returns the raw resource owner response.
102
     *
103
     * @return array
104
     */
105 3
    public function toArray()
106
    {
107 3
        return $this->response;
108
    }
109
}
110