EpicGamesResourceOwner   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A getUsername() 0 4 1
A toArray() 0 4 1
1
<?php
2
3
namespace MrPropre\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
7
8
class EpicGamesResourceOwner implements ResourceOwnerInterface
9
{
10
    use ArrayAccessorTrait;
11
12
    /**
13
     * @var array
14
     */
15
    protected $response;
16
17
    /**
18
     * Creates new resource owner.
19
     */
20 1
    public function __construct(array $response = [])
21
    {
22 1
        $this->response = $response;
23 1
    }
24
25
    /**
26
     * Get resource owner ID
27
     */
28 1
    public function getId(): ?string
29
    {
30 1
        return $this->getValueByKey($this->response, 'sub');
31
    }
32
33
    /**
34
     * Get resource owner username
35
     */
36 1
    public function getUsername(): ?string
37
    {
38 1
        return $this->getValueByKey($this->response, 'preferred_username');
39
    }
40
41
    /**
42
     * Returns the raw resource owner response.
43
     */
44 1
    public function toArray(): array
45
    {
46 1
        return $this->response;
47
    }
48
}
49