Passed
Push — develop ( 1f1308 )
by
unknown
04:21
created

Client::getActivityFollowing()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 10
cc 2
nc 2
nop 3
crap 6
1
<?php
2
3
namespace Strava\API;
4
5
use Strava\API\Service\ServiceInterface;
6
use Strava\API\Exception as ClientException;
7
use Strava\API\Service\Exception as ServiceException;
8
9
/**
10
 * Strava API Client
11
 *
12
 * @author Bas van Dorst
13
 * @package StravaPHP
14
 */
15
class Client
16
{
17
    /**
18
     * @var ServiceInterface $service
19
     */
20
    protected $service;
21
22
    /**
23
     * Initiate this class with a subclass of ServiceInterface. There are two
24
     * service subclasses available:
25
     * - Service\REST: Service which makes calls to the live Strava API
26
     * - Service\Stub: Service stub for test purposes (unit tests)
27
     *
28
     * @param ServiceInterface $service
29
     */
30 79
    public function __construct(ServiceInterface $service)
31
    {
32 79
        $this->service = $service;
33 79
    }
34
35
    /**
36
     * Retrieve current athlete
37
     *
38
     * @link    https://strava.github.io/api/v3/athlete/#get-details,
39
     *          https://strava.github.io/api/v3/athlete/#get-another-details
40
     * @param int $id
41
     * @return  array
42
     * @throws  Exception
43
     */
44 2
    public function getAthlete($id = null)
45
    {
46
        try {
47 2
            return $this->service->getAthlete($id);
48 1
        } catch (ServiceException $e) {
49 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
50
        }
51
    }
52
53
    /**
54
     * Retrieve athlete stats
55
     *
56
     * Only available for the authenticated athlete.
57
     *
58
     * @link    https://strava.github.io/api/v3/athlete/#stats
59
     * @param int $id
60
     * @return  array
61
     * @throws  ClientException
62
     */
63 1
    public function getAthleteStats($id)
64
    {
65
        try {
66 1
            return $this->service->getAthleteStats($id);
67
        } catch (ServiceException $e) {
68
            throw new ClientException('[SERVICE] ' . $e->getMessage());
69
        }
70
    }
71
72
    /**
73
     * Retrieve athlete routes
74
     *
75
     * @link    https://strava.github.io/api/v3/routes/#list
76
     * @param int $id
77
     * @return  array
78
     * @throws  ClientException
79
     */
80 1
    public function getAthleteRoutes($id, $type = null, $after = null, $page = null, $per_page = null)
81
    {
82
        try {
83 1
            return $this->service->getAthleteRoutes($id, $type, $after, $page, $per_page);
84
        } catch (ServiceException $e) {
85
            throw new ClientException('[SERVICE] ' . $e->getMessage());
86
        }
87
    }
88
89
    /**
90
     * List athlete clubs
91
     *
92
     * @link    https://strava.github.io/api/v3/clubs/#get-athletes
93
     * @return  array
94
     * @throws  Exception
95
     */
96 2
    public function getAthleteClubs()
97
    {
98
        try {
99 2
            return $this->service->getAthleteClubs();
100 1
        } catch (ServiceException $e) {
101 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
102
        }
103
    }
104
105
    /**
106
     * List athlete activities
107
     *
108
     * @link    https://strava.github.io/api/v3/activities/#get-activities
109
     * @param string $before
110
     * @param string $after
111
     * @param int $page
112
     * @param int $per_page
113
     * @return  array
114
     * @throws  Exception
115
     */
116 2
    public function getAthleteActivities($before = null, $after = null, $page = null, $per_page = null)
117
    {
118
        try {
119 2
            return $this->service->getAthleteActivities($before, $after, $page, $per_page);
120 1
        } catch (ServiceException $e) {
121 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
122
        }
123
    }
124
125
    /**
126
     * List athlete friends
127
     *
128
     * @link    https://strava.github.io/api/v3/follow/#friends
129
     * @param int $id
130
     * @param int $page
131
     * @param int $per_page
132
     * @return  array
133
     * @throws  Exception
134
     */
135 2
    public function getAthleteFriends($id = null, $page = null, $per_page = null)
136
    {
137
        try {
138 2
            return $this->service->getAthleteFriends($id, $page, $per_page);
139 1
        } catch (ServiceException $e) {
140 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
141
        }
142
    }
143
144
    /**
145
     * List athlete followers
146
     *
147
     * @link    https://strava.github.io/api/v3/follow/#followers
148
     * @param int $id
149
     * @param int $page
150
     * @param int $per_page
151
     * @return  array
152
     * @throws  Exception
153
     */
154 2
    public function getAthleteFollowers($id = null, $page = null, $per_page = null)
155
    {
156
        try {
157 2
            return $this->service->getAthleteFollowers($id, $page, $per_page);
158 1
        } catch (ServiceException $e) {
159 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
160
        }
161
    }
162
163
    /**
164
     * List both following
165
     *
166
     * @link    https://strava.github.io/api/v3/follow/#both
167
     * @param int $id
168
     * @param int $page
169
     * @param int $per_page
170
     * @return  array
171
     * @throws  Exception
172
     */
173 2
    public function getAthleteBothFollowing($id, $page = null, $per_page = null)
174
    {
175
        try {
176 2
            return $this->service->getAthleteBothFollowing($id, $page, $per_page);
177 1
        } catch (ServiceException $e) {
178 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
179
        }
180
    }
181
182
    /**
183
     * List athlete K/QOMs/CRs
184
     *
185
     * @link    https://strava.github.io/api/v3/athlete/#koms
186
     * @param int $id
187
     * @param int $page
188
     * @param int $per_page
189
     * @return  array
190
     * @throws  Exception
191
     */
192 2
    public function getAthleteKom($id, $page = null, $per_page = null)
193
    {
194
        try {
195 2
            return $this->service->getAthleteKom($id, $page, $per_page);
196 1
        } catch (ServiceException $e) {
197 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
198
        }
199
    }
200
201
    /**
202
     * List athlete zones
203
     *
204
     * @link    https://strava.github.io/api/v3/athlete/#zones
205
     * @return  array
206
     * @throws  Exception
207
     */
208 2
    public function getAthleteZones()
209
    {
210
        try {
211 2
            return $this->service->getAthleteZones();
212 1
        } catch (ServiceException $e) {
213 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
214
        }
215
    }
216
217
218
    /**
219
     * List starred segment
220
     *
221
     * @link    https://strava.github.io/api/v3/segments/#starred
222
     * @param int $id
223
     * @param int $page
224
     * @param int $per_page
225
     * @return  array
226
     * @throws  Exception
227
     */
228 2
    public function getAthleteStarredSegments($id = null, $page = null, $per_page = null)
229
    {
230
        try {
231 2
            return $this->service->getAthleteStarredSegments($id, $page, $per_page);
232 1
        } catch (ServiceException $e) {
233 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
234
        }
235
    }
236
237
    /**
238
     * Update current athlete
239
     *
240
     * @link    https://strava.github.io/api/v3/athlete/#update
241
     * @param string $city
242
     * @param string $state
243
     * @param string $country
244
     * @param string $sex
245
     * @param float $weight
246
     * @return  array
247
     * @throws  Exception
248
     */
249 2
    public function updateAthlete($city, $state, $country, $sex, $weight)
250
    {
251
        try {
252 2
            return $this->service->updateAthlete($city, $state, $country, $sex, $weight);
253 1
        } catch (ServiceException $e) {
254 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
255
        }
256
    }
257
258
    /**
259
     * Retrieve an activity
260
     *
261
     * @link    https://strava.github.io/api/v3/athlete/#get-details,
262
     *          https://strava.github.io/api/v3/athlete/#get-another-details
263
     * @param int $id
264
     * @param boolean $include_all_efforts
265
     * @return  array
266
     * @throws  Exception
267
     */
268 2
    public function getActivity($id, $include_all_efforts = null)
269
    {
270
        try {
271 2
            return $this->service->getActivity($id, $include_all_efforts);
272 1
        } catch (ServiceException $e) {
273 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
274
        }
275
    }
276
277
    /**
278
     * List activity comments
279
     *
280
     * @link    https://strava.github.io/api/v3/comments/#list
281
     * @param int $id
282
     * @param boolean $markdown
283
     * @param int $page
284
     * @param int $per_page
285
     * @return  array
286
     * @throws  Exception
287
     */
288 2
    public function getActivityComments($id, $markdown = null, $page = null, $per_page = null)
289
    {
290
        try {
291 2
            return $this->service->getActivityComments($id, $markdown, $page, $per_page);
292 1
        } catch (ServiceException $e) {
293 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
294
        }
295
    }
296
297
    /**
298
     * List activity kudoers
299
     *
300
     * @link    https://strava.github.io/api/v3/kudos/#list
301
     * @param int $id
302
     * @param int $page
303
     * @param int $per_page
304
     * @return  array
305
     * @throws  Exception
306
     */
307 2
    public function getActivityKudos($id, $page = null, $per_page = null)
308
    {
309
        try {
310 2
            return $this->service->getActivityKudos($id, $page, $per_page);
311 1
        } catch (ServiceException $e) {
312 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
313
        }
314
    }
315
316
    /**
317
     * List activity photos
318
     *
319
     * @link    https://strava.github.io/api/v3/photos/#list
320
     * @param int $id
321
     * @param int $size In pixels.
322
     * @param string $photo_sources Must be "true".
323
     * @return  array
324
     * @throws  Exception
325
     */
326 2
    public function getActivityPhotos($id, $size = 2048, $photo_sources = 'true')
327
    {
328
        try {
329 2
            return $this->service->getActivityPhotos($id, $size, $photo_sources);
330 1
        } catch (ServiceException $e) {
331 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
332
        }
333
    }
334
335
    /**
336
     * List activity zones
337
     *
338
     * @link    https://strava.github.io/api/v3/activities/#zones
339
     * @param int $id
340
     * @return  array
341
     * @throws  Exception
342
     */
343 2
    public function getActivityZones($id)
344
    {
345
        try {
346 2
            return $this->service->getActivityZones($id);
347 1
        } catch (ServiceException $e) {
348 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
349
        }
350
    }
351
352
    /**
353
     * List activity laps
354
     *
355
     * @link    https://strava.github.io/api/v3/activities/#laps
356
     * @param int $id
357
     * @return  array
358
     * @throws  Exception
359
     */
360 2
    public function getActivityLaps($id)
361
    {
362
        try {
363 2
            return $this->service->getActivityLaps($id);
364 1
        } catch (ServiceException $e) {
365 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
366
        }
367
    }
368
369
    /**
370
     * Check upload status
371
     *
372
     * @link    https://strava.github.io/api/v3/uploads/#get-status
373
     * @param int $id
374
     * @return  array
375
     * @throws  Exception
376
     */
377 2
    public function getActivityUploadStatus($id)
378
    {
379
        try {
380 2
            return $this->service->getActivityUploadStatus($id);
381 1
        } catch (ServiceException $e) {
382 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
383
        }
384
    }
385
386
    /**
387
     * Create an activity
388
     *
389
     * @link    https://strava.github.io/api/v3/activities/#create
390
     * @param string $name
391
     * @param string $type
392
     * @param string $start_date_local
393
     * @param int $elapsed_time
394
     * @param string $description
395
     * @param float $distance
396
     * @param int $private
397
     * @param int $trainer
398
     * @return  array
399
     * @throws  Exception
400
     */
401 2
    public function createActivity($name, $type, $start_date_local, $elapsed_time, $description = null, $distance = null, $private = null, $trainer = null)
402
    {
403
        try {
404 2
            return $this->service->createActivity($name, $type, $start_date_local, $elapsed_time, $description, $distance, $private, $trainer);
405 1
        } catch (ServiceException $e) {
406 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
407
        }
408
    }
409
410
    /**
411
     * Upload an activity
412
     *
413
     * @link    https://strava.github.io/api/v3/uploads/#post-file
414
     * @param mixed $file
415
     * @param string $activity_type
416
     * @param string $name
417
     * @param string $description
418
     * @param int $private
419
     * @param int $trainer
420
     * @param int $commute
421
     * @param string $data_type
422
     * @param string $external_id
423
     * @return  array
424
     * @throws  Exception
425
     */
426 2
    public function uploadActivity($file, $activity_type = null, $name = null, $description = null, $private = null, $trainer = null, $commute = null, $data_type = null, $external_id = null)
427
    {
428
        try {
429 2
            return $this->service->uploadActivity($file, $activity_type, $name, $description, $private, $trainer, $commute, $data_type, $external_id);
430 1
        } catch (ServiceException $e) {
431 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
432
        }
433
    }
434
435
    /**
436
     * Update an activity
437
     *
438
     * @link    https://strava.github.io/api/v3/activities/#put-updates
439
     * @param int $id
440
     * @param string $name
441
     * @param string $type
442
     * @param boolean $private
443
     * @param boolean $commute
444
     * @param boolean $trainer
445
     * @param string $gear_id
446
     * @param string $description
447
     * @return  array
448
     * @throws  Exception
449
     */
450 2
    public function updateActivity($id, $name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null)
451
    {
452
        try {
453 2
            return $this->service->updateActivity($id, $name, $type, $private, $commute, $trainer, $gear_id, $description);
454 1
        } catch (ServiceException $e) {
455 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
456
        }
457
    }
458
459
    /**
460
     * Delete an activity
461
     *
462
     * @link    https://strava.github.io/api/v3/activities/#delete
463
     * @param int $id
464
     * @return  array
465
     * @throws  Exception
466
     */
467 2
    public function deleteActivity($id)
468
    {
469
        try {
470 2
            return $this->service->deleteActivity($id);
471 1
        } catch (ServiceException $e) {
472 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
473
        }
474
    }
475
476
    /**
477
     * Retrieve gear
478
     *
479
     * @link    https://strava.github.io/api/v3/gear/
480
     * @param int $id
481
     * @return  array
482
     * @throws  Exception
483
     */
484 2
    public function getGear($id)
485
    {
486
        try {
487 2
            return $this->service->getGear($id);
488 1
        } catch (ServiceException $e) {
489 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
490
        }
491
    }
492
493
    /**
494
     * Retrieve a club
495
     *
496
     * @link    https://strava.github.io/api/v3/clubs/#get-details
497
     * @param int $id
498
     * @return  array
499
     * @throws  Exception
500
     */
501 2
    public function getClub($id)
502
    {
503
        try {
504 2
            return $this->service->getClub($id);
505 1
        } catch (ServiceException $e) {
506 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
507
        }
508
    }
509
510
    /**
511
     * List club members
512
     *
513
     * @link    https://strava.github.io/api/v3/clubs/#get-members
514
     * @param int $id
515
     * @param int $page
516
     * @param int $per_page
517
     * @return  array
518
     * @throws  Exception
519
     */
520 2
    public function getClubMembers($id, $page = null, $per_page = null)
521
    {
522
        try {
523 2
            return $this->service->getClubMembers($id, $page, $per_page);
524 1
        } catch (ServiceException $e) {
525 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
526
        }
527
    }
528
529
    /**
530
     * List club activities
531
     *
532
     * @link    https://strava.github.io/api/v3/clubs/#get-activities
533
     * @param int $id
534
     * @param int $page
535
     * @param int $per_page
536
     * @return  array
537
     * @throws  Exception
538
     */
539 2
    public function getClubActivities($id, $page = null, $per_page = null)
540
    {
541
        try {
542 2
            return $this->service->getClubActivities($id, $page, $per_page);
543 1
        } catch (ServiceException $e) {
544 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
545
        }
546
    }
547
548
    /**
549
     * List club announcements
550
     *
551
     * @link    https://strava.github.io/api/v3/clubs/#get-announcements
552
     * @param int $id
553
     * @return  array
554
     * @throws  Exception
555
     */
556 2
    public function getClubAnnouncements($id)
557
    {
558
        try {
559 2
            return $this->service->getClubAnnouncements($id);
560 1
        } catch (ServiceException $e) {
561 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
562
        }
563
    }
564
565
    /**
566
     * List club group events
567
     *
568
     * @link    https://strava.github.io/api/v3/clubs/#get-group-events
569
     * @param int $id
570
     * @return  array
571
     * @throws  Exception
572
     */
573 2
    public function getClubGroupEvents($id)
574
    {
575
        try {
576 2
            return $this->service->getClubGroupEvents($id);
577 1
        } catch (ServiceException $e) {
578 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
579
        }
580
    }
581
582
    /**
583
     * Join a club
584
     *
585
     * @link    https://strava.github.io/api/v3/clubs/#join
586
     * @param int $id
587
     * @return  array
588
     * @throws  Exception
589
     */
590 2
    public function joinClub($id)
591
    {
592
        try {
593 2
            return $this->service->joinClub($id);
594 1
        } catch (ServiceException $e) {
595 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
596
        }
597
    }
598
599
    /**
600
     * Leave a club
601
     *
602
     * @link    https://strava.github.io/api/v3/clubs/#leave
603
     * @param int $id
604
     * @return  array
605
     * @throws  Exception
606
     */
607 2
    public function leaveClub($id)
608
    {
609
        try {
610 2
            return $this->service->leaveClub($id);
611 1
        } catch (ServiceException $e) {
612 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
613
        }
614
    }
615
616
    /**
617
     * Get route details
618
     *
619
     * @link    https://strava.github.io/api/v3/routes/#list
620
     * @param int $id
621
     * @return  array
622
     * @throws  Exception
623
     */
624 2
    public function getRoute($id)
625
    {
626
        try {
627 2
            return $this->service->getRoute($id);
628 1
        } catch (ServiceException $e) {
629 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
630
        }
631
    }
632
633
    /**
634
     * Retrieve a segment
635
     *
636
     * @link    https://strava.github.io/api/v3/segments/#retrieve
637
     * @param int $id
638
     * @return  array
639
     * @throws  Exception
640
     */
641 2
    public function getSegment($id)
642
    {
643
        try {
644 2
            return $this->service->getSegment($id);
645 1
        } catch (ServiceException $e) {
646 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
647
        }
648
    }
649
650
    /**
651
     * Segment leaderboards
652
     *
653
     * @link    https://strava.github.io/api/v3/segments/#leaderboard
654
     * @param int $id
655
     * @param string $gender
656
     * @param string $age_group
657
     * @param string $weight_class
658
     * @param boolean $following
659
     * @param int $club_id
660
     * @param string $date_range
661
     * @param int $context_entries
662
     * @param int $page
663
     * @param int $per_page
664
     * @return  array
665
     * @throws  Exception
666
     */
667 2
    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)
668
    {
669
        try {
670 2
            return $this->service->getSegmentLeaderboard($id, $gender, $age_group, $weight_class, $following, $club_id, $date_range, $context_entries, $page, $per_page);
671 1
        } catch (ServiceException $e) {
672 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
673
        }
674
    }
675
676
    /**
677
     * Segment explorer
678
     *
679
     * @link    https://strava.github.io/api/v3/segments/#explore
680
     * @param string $bounds
681
     * @param string $activity_type
682
     * @param int $min_cat
683
     * @param int $max_cat
684
     * @return  array
685
     * @throws  Exception
686
     */
687 2
    public function getSegmentExplorer($bounds, $activity_type = 'riding', $min_cat = null, $max_cat = null)
688
    {
689
        try {
690 2
            return $this->service->getSegmentExplorer($bounds, $activity_type, $min_cat, $max_cat);
691 1
        } catch (ServiceException $e) {
692 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
693
        }
694
    }
695
696
    /**
697
     * List efforts filtered by athlete and/or a date range
698
     *
699
     * @link    https://strava.github.io/api/v3/segments/#efforts
700
     * @param int $id
701
     * @param int $athlete_id
702
     * @param string $start_date_local
703
     * @param string $end_date_local
704
     * @param int $page
705
     * @param int $per_page
706
     * @return  array
707
     * @throws  Exception
708
     */
709 2
    public function getSegmentEffort($id, $athlete_id = null, $start_date_local = null, $end_date_local = null, $page = null, $per_page = null)
710
    {
711
        try {
712 2
            return $this->service->getSegmentEffort($id, $athlete_id, $start_date_local, $end_date_local, $page, $per_page);
713 1
        } catch (ServiceException $e) {
714 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
715
        }
716
    }
717
718
    /**
719
     * Retrieve activity streams
720
     *
721
     * @link    https://strava.github.io/api/v3/streams/#activity
722
     * @param int $id
723
     * @param string $types
724
     * @param string $resolution
725
     * @param string $series_type
726
     * @return  array
727
     * @throws  Exception
728
     */
729 2
    public function getStreamsActivity($id, $types, $resolution = null, $series_type = 'distance')
730
    {
731
        try {
732 2
            return $this->service->getStreamsActivity($id, $types, $resolution, $series_type);
733 1
        } catch (ServiceException $e) {
734 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
735
        }
736
    }
737
738
    /**
739
     * Retrieve effort streams
740
     *
741
     * @link    https://strava.github.io/api/v3/streams/#effort
742
     * @param int $id
743
     * @param string $types
744
     * @param string $resolution
745
     * @param string $series_type
746
     * @return  array
747
     * @throws  Exception
748
     */
749 2
    public function getStreamsEffort($id, $types, $resolution = null, $series_type = 'distance')
750
    {
751
        try {
752 2
            return $this->service->getStreamsEffort($id, $types, $resolution, $series_type);
753 1
        } catch (ServiceException $e) {
754 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
755
        }
756
    }
757
758
    /**
759
     * Retrieve segment streams
760
     * @link    https://strava.github.io/api/v3/streams/#segment
761
     * @param int $id
762
     * @param string $types
763
     * @param string $resolution
764
     * @param string $series_type
765
     * @return  array
766
     * @throws  Exception
767
     */
768 2
    public function getStreamsSegment($id, $types, $resolution = null, $series_type = 'distance')
769
    {
770
        try {
771 2
            return $this->service->getStreamsSegment($id, $types, $resolution, $series_type);
772 1
        } catch (ServiceException $e) {
773 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
774
        }
775
    }
776
777
    /**
778
     * Retrieve route streams
779
     *
780
     * @link    https://strava.github.io/api/v3/streams/#routes
781
     * @param int $id
782
     * @return  array
783
     * @throws  Exception
784
     */
785 2
    public function getStreamsRoute($id)
786
    {
787
        try {
788 2
            return $this->service->getStreamsRoute($id);
789 1
        } catch (ServiceException $e) {
790 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
791
        }
792
    }
793
}
794