1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace League\OAuth2\Client\Provider; |
4
|
|
|
|
5
|
|
|
class RunkeeperResourceOwner implements ResourceOwnerInterface |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Domain |
9
|
|
|
* |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
protected $domain; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Raw response |
16
|
|
|
* |
17
|
|
|
* @var array |
18
|
|
|
*/ |
19
|
|
|
protected $response; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Creates new resource owner. |
23
|
|
|
* |
24
|
|
|
* @param array $response |
25
|
|
|
*/ |
26
|
3 |
|
public function __construct(array $response = []) |
27
|
|
|
{ |
28
|
3 |
|
$this->response = $response; |
29
|
3 |
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Returns the identifier of the authorized resource owner. |
33
|
|
|
* Runkeeper has no id when profile requested |
34
|
|
|
* |
35
|
|
|
* @return null |
36
|
|
|
*/ |
37
|
3 |
|
public function getId() |
38
|
|
|
{ |
39
|
3 |
|
return $this->response['userID'] ?: null; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Get resource owner email |
44
|
|
|
* |
45
|
|
|
* @return string|null |
46
|
|
|
*/ |
47
|
3 |
|
public function getEmail() |
48
|
|
|
{ |
49
|
3 |
|
return $this->response['email'] ?: null; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Get resource owner name |
54
|
|
|
* |
55
|
|
|
* @return string|null |
56
|
|
|
*/ |
57
|
3 |
|
public function getName() |
58
|
|
|
{ |
59
|
3 |
|
return $this->response['name'] ?: null; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get resource owner location |
64
|
|
|
* |
65
|
|
|
* @return string|null |
66
|
|
|
*/ |
67
|
3 |
|
public function getLocation() |
68
|
|
|
{ |
69
|
3 |
|
return $this->response['location'] ?: null; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Get resource owner athlete type |
74
|
|
|
* |
75
|
|
|
* @return string|null |
76
|
|
|
*/ |
77
|
3 |
|
public function getAthleteType() |
78
|
|
|
{ |
79
|
3 |
|
return $this->response['athlete_type'] ?: null; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get resource owner gender |
84
|
|
|
* |
85
|
|
|
* @return string|null |
86
|
|
|
*/ |
87
|
3 |
|
public function getGender() |
88
|
|
|
{ |
89
|
3 |
|
return $this->response['gender'] ?: null; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Get resource owner birthdat |
94
|
|
|
* |
95
|
|
|
* @return string|null |
96
|
|
|
*/ |
97
|
3 |
|
public function getBirthday() |
98
|
|
|
{ |
99
|
3 |
|
return $this->response['birthday'] ?: null; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Get resource owner elite status (subscriber) |
104
|
|
|
* |
105
|
|
|
* @return boolean|false |
106
|
|
|
*/ |
107
|
3 |
|
public function getElite() |
108
|
|
|
{ |
109
|
3 |
|
return $this->response['elite'] ?: false; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Get resource owner public profile url |
114
|
|
|
* |
115
|
|
|
* @return boolean|false |
116
|
|
|
*/ |
117
|
3 |
|
public function getProfile() |
118
|
|
|
{ |
119
|
3 |
|
return $this->response['profile'] ?: false; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Return all of the owner details available as an array. |
124
|
|
|
* |
125
|
|
|
* @return array |
126
|
|
|
*/ |
127
|
3 |
|
public function toArray() |
128
|
|
|
{ |
129
|
3 |
|
return $this->response; |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|