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
|
|
|
|