1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Strava\API\Service; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Strava stub Service |
7
|
|
|
* |
8
|
|
|
* @author Bas van Dorst |
9
|
|
|
* @package StravaPHP |
10
|
|
|
*/ |
11
|
|
|
class Stub implements ServiceInterface |
12
|
|
|
{ |
13
|
1 |
|
public function getAthlete($id = null) |
14
|
|
|
{ |
15
|
1 |
|
$json = '{ "id": 227615, "resource_state": 2, "firstname": "John", "lastname": "Applestrava", "profile_medium": "http://pics.com/227615/medium.jpg", "profile": "http://pics.com/227615/large.jpg", "city": "San Francisco", "state": "CA", "country": "United States", "sex": "M", "friend": null, "follower": "accepted", "premium": true, "created_at": "2011-03-19T21:59:57Z", "updated_at": "2013-09-05T16:46:54Z", "approve_followers": false }'; |
16
|
1 |
|
return $this->format($json); |
17
|
|
|
} |
18
|
|
|
|
19
|
1 |
|
public function getAthleteStats($id) |
20
|
|
|
{ |
21
|
1 |
|
$json = '[ { "biggest_ride_distance": 175454.0, "biggest_climb_elevation_gain": 1882.6999999999998, "recent_ride_totals": { "count": 3, "distance": 12054.900146484375, "moving_time": 2190, "elapsed_time": 2331, "elevation_gain": 36.0, "achievement_count": 0 }, "recent_run_totals": { "count": 23, "distance": 195948.40002441406, "moving_time": 65513, "elapsed_time": 75232, "elevation_gain": 2934.3999996185303, "achievement_count": 46 }, "recent_swim_totals": { "count": 2, "distance": 1117.2000122070312, "moving_time": 1744, "elapsed_time": 1942, "elevation_gain": 0.0, "achievement_count": 0 }, "ytd_ride_totals": { "count": 134, "distance": 4927252, "moving_time": 659982, "elapsed_time": 892644, "elevation_gain": 49940 }, "ytd_run_totals": { "count": 111, "distance": 917100, "moving_time": 272501, "elapsed_time": 328059, "elevation_gain": 7558 }, "ytd_swim_totals": { "count": 8, "distance": 10372, "moving_time": 8784, "elapsed_time": 11123, "elevation_gain": 0 }, "all_ride_totals": { "count": 375, "distance": 15760015, "moving_time": 2155741, "elapsed_time": 2684286, "elevation_gain": 189238 }, "all_run_totals": { "count": 272, "distance": 2269557, "moving_time": 673678, "elapsed_time": 812095, "elevation_gain": 23780 }, "all_swim_totals": { "count": 8, "distance": 10372, "moving_time": 8784, "elapsed_time": 11123, "elevation_gain": 0} } ]'; |
22
|
1 |
|
return $this->format($json); |
23
|
|
|
} |
24
|
|
|
|
25
|
1 |
|
public function getAthleteRoutes($id, $type = null, $after = null, $page = null, $per_page = null) |
26
|
|
|
{ |
27
|
1 |
|
$json = '[{"athlete":{"id":19,"resource_state":2},"id":743064,"resource_state":2,"description":"","distance":17781.6,"elevation_gain":207.8}]'; |
28
|
1 |
|
return $this->format($json); |
29
|
|
|
} |
30
|
|
|
|
31
|
1 |
|
public function getAthleteClubs() |
32
|
|
|
{ |
33
|
1 |
|
$json = '[ { "id": 1, "resource_state": 2, "name": "Team Strava Cycling", "profile_medium": "http://pics.com/clubs/1/medium.jpg", "profile": "http://pics.com/clubs/1/large.jpg" } ]'; |
34
|
1 |
|
return $this->format($json); |
35
|
|
|
} |
36
|
|
|
|
37
|
1 |
|
public function getAthleteActivities($before = null, $after = null, $page = null, $per_page = null) |
38
|
|
|
{ |
39
|
1 |
|
$json = '{"response": 1}'; |
40
|
1 |
|
return $this->format($json); |
41
|
|
|
} |
42
|
|
|
|
43
|
1 |
|
public function getAthleteFriends($id = null, $page = null, $per_page = null) |
44
|
|
|
{ |
45
|
1 |
|
$json = '{"response": 1}'; |
46
|
1 |
|
return $this->format($json); |
47
|
|
|
} |
48
|
|
|
|
49
|
1 |
|
public function getAthleteFollowers($id = null, $page = null, $per_page = null) |
50
|
|
|
{ |
51
|
1 |
|
$json = '{"response": 1}'; |
52
|
1 |
|
return $this->format($json); |
53
|
|
|
} |
54
|
|
|
|
55
|
1 |
|
public function getAthleteBothFollowing($id, $page = null, $per_page = null) |
56
|
|
|
{ |
57
|
1 |
|
$json = '{"response": 1}'; |
58
|
1 |
|
return $this->format($json); |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
public function getAthleteKom($id, $page = null, $per_page = null) |
62
|
|
|
{ |
63
|
1 |
|
$json = '{"response": 1}'; |
64
|
1 |
|
return $this->format($json); |
65
|
|
|
} |
66
|
|
|
|
67
|
1 |
|
public function getAthleteZones() |
68
|
|
|
{ |
69
|
1 |
|
$json = '{"heart_rate":{"custom_zones":false,"zones":[{"min":0,"max":115},{"min":115,"max":152},{"min":152,"max":171},{"min":171,"max":190},{"min":190,"max":-1}]},"power":{"zones":[{"min":0,"max":180},{"min":181,"max":246},{"min":247,"max":295},{"min":296,"max":344},{"min":345,"max":393},{"min":394,"max":492},{"min":493,"max":-1}]}}'; |
70
|
1 |
|
return $this->format($json); |
71
|
|
|
} |
72
|
|
|
|
73
|
1 |
|
public function getAthleteStarredSegments($id = null, $page = null, $per_page = null) |
74
|
|
|
{ |
75
|
1 |
|
$json = '{"response": 1}'; |
76
|
1 |
|
return $this->format($json); |
77
|
|
|
} |
78
|
|
|
|
79
|
1 |
|
public function updateAthlete($city, $state, $country, $sex, $weight) |
80
|
|
|
{ |
81
|
1 |
|
$json = '{"response": 1}'; |
82
|
1 |
|
return $this->format($json); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getActivityFollowing($before = null, $page = null, $per_page = null) |
|
|
|
|
86
|
|
|
{ |
87
|
|
|
$json = '{"response": 1}'; |
88
|
|
|
return $this->format($json); |
89
|
|
|
} |
90
|
|
|
|
91
|
1 |
|
public function getActivity($id, $include_all_efforts = null) |
92
|
|
|
{ |
93
|
1 |
|
$json = '{"response": 1}'; |
94
|
1 |
|
return $this->format($json); |
95
|
|
|
} |
96
|
|
|
|
97
|
1 |
|
public function getActivityComments($id, $markdown = null, $page = null, $per_page = null) |
98
|
|
|
{ |
99
|
1 |
|
$json = '{"response": 1}'; |
100
|
1 |
|
return $this->format($json); |
101
|
|
|
} |
102
|
|
|
|
103
|
1 |
|
public function getActivityKudos($id, $page = null, $per_page = null) |
104
|
|
|
{ |
105
|
1 |
|
$json = '{"response": 1}'; |
106
|
1 |
|
return $this->format($json); |
107
|
|
|
} |
108
|
|
|
|
109
|
1 |
|
public function getActivityPhotos($id, $size = 2048, $photo_sources = 'true') |
110
|
|
|
{ |
111
|
1 |
|
$json = '{"response": 1}'; |
112
|
1 |
|
return $this->format($json); |
113
|
|
|
} |
114
|
|
|
|
115
|
1 |
|
public function getActivityZones($id) |
116
|
|
|
{ |
117
|
1 |
|
$json = '{"response": 1}'; |
118
|
1 |
|
return $this->format($json); |
119
|
|
|
} |
120
|
|
|
|
121
|
1 |
|
public function getActivityLaps($id) |
122
|
|
|
{ |
123
|
1 |
|
$json = '{"response": 1}'; |
124
|
1 |
|
return $this->format($json); |
125
|
|
|
} |
126
|
|
|
|
127
|
1 |
|
public function getActivityUploadStatus($id) |
128
|
|
|
{ |
129
|
1 |
|
$json = '{"response": 1}'; |
130
|
1 |
|
return $this->format($json); |
131
|
|
|
} |
132
|
|
|
|
133
|
1 |
|
public function createActivity($name, $type, $start_date_local, $elapsed_time, $description = null, $distance = null, $private = null, $trainer = null) |
134
|
|
|
{ |
135
|
1 |
|
$json = '{"response": 1}'; |
136
|
1 |
|
return $this->format($json); |
137
|
|
|
} |
138
|
|
|
|
139
|
1 |
|
public function uploadActivity($file, $activity_type = null, $name = null, $description = null, $private = null, $trainer = null, $commute = null, $data_type = null, $external_id = null) |
140
|
|
|
{ |
141
|
1 |
|
$json = '{"response": 1}'; |
142
|
1 |
|
return $this->format($json); |
143
|
|
|
} |
144
|
|
|
|
145
|
1 |
|
public function updateActivity($id, $name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null) |
146
|
|
|
{ |
147
|
1 |
|
$json = '{"response": 1}'; |
148
|
1 |
|
return $this->format($json); |
149
|
|
|
} |
150
|
|
|
|
151
|
1 |
|
public function deleteActivity($id) |
152
|
|
|
{ |
153
|
1 |
|
$json = '{"response": 1}'; |
154
|
1 |
|
return $this->format($json); |
155
|
|
|
} |
156
|
|
|
|
157
|
1 |
|
public function getGear($id) |
158
|
|
|
{ |
159
|
1 |
|
$json = '{"response": 1}'; |
160
|
1 |
|
return $this->format($json); |
161
|
|
|
} |
162
|
|
|
|
163
|
1 |
|
public function getClub($id) |
164
|
|
|
{ |
165
|
1 |
|
$json = '{"response": 1}'; |
166
|
1 |
|
return $this->format($json); |
167
|
|
|
} |
168
|
|
|
|
169
|
1 |
|
public function getClubMembers($id, $page = null, $per_page = null) |
170
|
|
|
{ |
171
|
1 |
|
$json = '{"response": 1}'; |
172
|
1 |
|
return $this->format($json); |
173
|
|
|
} |
174
|
|
|
|
175
|
1 |
|
public function getClubActivities($id, $page = null, $per_page = null) |
176
|
|
|
{ |
177
|
1 |
|
$json = '{"response": 1}'; |
178
|
1 |
|
return $this->format($json); |
179
|
|
|
} |
180
|
|
|
|
181
|
1 |
|
public function getClubAnnouncements($id) |
182
|
|
|
{ |
183
|
1 |
|
$json = '{"response": 1}'; |
184
|
1 |
|
return $this->format($json); |
185
|
|
|
} |
186
|
|
|
|
187
|
1 |
|
public function getClubGroupEvents($id) |
188
|
|
|
{ |
189
|
1 |
|
$json = '{"response": 1}'; |
190
|
1 |
|
return $this->format($json); |
191
|
|
|
} |
192
|
|
|
|
193
|
1 |
|
public function joinClub($id) |
194
|
|
|
{ |
195
|
1 |
|
$json = '{"response": 1}'; |
196
|
1 |
|
return $this->format($json); |
197
|
|
|
} |
198
|
|
|
|
199
|
1 |
|
public function leaveClub($id) |
200
|
|
|
{ |
201
|
1 |
|
$json = '{"response": 1}'; |
202
|
1 |
|
return $this->format($json); |
203
|
|
|
} |
204
|
|
|
|
205
|
1 |
|
public function getRoute($id) |
206
|
|
|
{ |
207
|
1 |
|
$json = '{"response": 1}'; |
208
|
1 |
|
return $this->format($json); |
209
|
|
|
} |
210
|
|
|
|
211
|
1 |
|
public function getRouteAsGPX($id) |
212
|
|
|
{ |
213
|
1 |
|
$gpx = '<?xml version="1.0" encoding="UTF-8"?><gpx creator="StravaGPX"/>'; |
214
|
1 |
|
return $gpx; |
215
|
|
|
} |
216
|
|
|
|
217
|
1 |
|
public function getRouteAsTCX($id) |
218
|
|
|
{ |
219
|
1 |
|
$tcx = '<?xml version="1.0" encoding="UTF-8"?><TrainingCenterDatabase/>'; |
220
|
1 |
|
return $tcx; |
221
|
|
|
} |
222
|
|
|
|
223
|
1 |
|
public function getSegment($id) |
224
|
|
|
{ |
225
|
1 |
|
$json = '{"response": 1}'; |
226
|
1 |
|
return $this->format($json); |
227
|
|
|
} |
228
|
|
|
|
229
|
1 |
|
public function getSegmentLeaderboard($id, $gender = null, $age_group = null, $weight_class = null, $following = null, $club_id = null, $date_range = null, $context_entries = null, $page = null, $per_page = null) |
230
|
|
|
{ |
231
|
1 |
|
$json = '{"response": 1}'; |
232
|
1 |
|
return $this->format($json); |
233
|
|
|
} |
234
|
|
|
|
235
|
1 |
|
public function getSegmentExplorer($bounds, $activity_type = 'riding', $min_cat = null, $max_cat = null) |
236
|
|
|
{ |
237
|
1 |
|
$json = '{"response": 1}'; |
238
|
1 |
|
return $this->format($json); |
239
|
|
|
} |
240
|
|
|
|
241
|
1 |
|
public function getSegmentEffort($id, $athlete_id = null, $start_date_local = null, $end_date_local = null, $page = null, $per_page = null) |
242
|
|
|
{ |
243
|
1 |
|
$json = '{"response": 1}'; |
244
|
1 |
|
return $this->format($json); |
245
|
|
|
} |
246
|
|
|
|
247
|
1 |
|
public function getStreamsActivity($id, $types, $resolution = null, $series_type = 'distance') |
248
|
|
|
{ |
249
|
1 |
|
$json = '{"response": 1}'; |
250
|
1 |
|
return $this->format($json); |
251
|
|
|
} |
252
|
|
|
|
253
|
1 |
|
public function getStreamsEffort($id, $types, $resolution = null, $series_type = 'distance') |
254
|
|
|
{ |
255
|
1 |
|
$json = '{"response": 1}'; |
256
|
1 |
|
return $this->format($json); |
257
|
|
|
} |
258
|
|
|
|
259
|
1 |
|
public function getStreamsSegment($id, $types, $resolution = null, $series_type = 'distance') |
260
|
|
|
{ |
261
|
1 |
|
$json = '{"response": 1}'; |
262
|
1 |
|
return $this->format($json); |
263
|
|
|
} |
264
|
|
|
|
265
|
1 |
|
public function getStreamsRoute($id) |
266
|
|
|
{ |
267
|
1 |
|
$json = '{"response": 1}'; |
268
|
1 |
|
return $this->format($json); |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @param string $result |
273
|
|
|
* @return mixed |
274
|
|
|
*/ |
275
|
40 |
|
private function format($result) |
276
|
|
|
{ |
277
|
40 |
|
return json_decode($result, true); |
278
|
|
|
} |
279
|
|
|
} |
280
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.