SpotifyResourceOwner   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 14
lcom 1
cbo 0
dl 0
loc 80
ccs 28
cts 28
cp 1
rs 10
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getBirthDate() 0 4 1
A getCountry() 0 4 1
A getDisplayName() 0 4 1
A getEmail() 0 4 1
A getExternalUrls() 0 4 1
A getFollowers() 0 4 1
A getHref() 0 4 1
A getId() 0 4 1
A getImages() 0 4 1
A getProduct() 0 4 1
A getType() 0 4 1
A getUri() 0 4 1
A toArray() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\OAuth2\Client\Provider;
6
7
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
8
9
class SpotifyResourceOwner implements ResourceOwnerInterface
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $data;
15
16
    public function __construct(array $response)
17
    {
18
        $this->data = $response;
19 3
    }
20
21 3
    public function getBirthDate(): ?string
22 3
    {
23
        return $this->data['birthdate'] ?? null;
24 2
    }
25
26 2
    public function getCountry(): ?string
27
    {
28
        return $this->data['country'] ?? null;
29 2
    }
30
31 2
    public function getDisplayName(): string
32
    {
33
        return $this->data['display_name'];
34 2
    }
35
36 2
    public function getEmail(): ?string
37
    {
38
        return $this->data['email'] ?? null;
39 2
    }
40
41 2
    public function getExternalUrls(): array
42
    {
43
        return $this->data['external_urls'];
44 2
    }
45
46 2
    public function getFollowers(): array
47
    {
48
        return $this->data['followers'];
49 2
    }
50
51 2
    public function getHref(): string
52
    {
53
        return $this->data['href'];
54 2
    }
55
56 2
    public function getId(): string
57
    {
58
        return $this->data['id'];
59 2
    }
60
61 2
    public function getImages(): array
62
    {
63
        return $this->data['images'];
64 2
    }
65
66 2
    public function getProduct(): ?string
67
    {
68
        return $this->data['product'] ?? null;
69 2
    }
70
71 2
    public function getType(): string
72
    {
73
        return $this->data['type'];
74 2
    }
75
76 2
    public function getUri(): string
77
    {
78
        return $this->data['uri'];
79 2
    }
80
81 2
    /**
82
     * Return all of the owner details available as an array.
83
     */
84
    public function toArray(): array
85
    {
86
        return $this->data;
87 1
    }
88
}
89