Completed
Push — master ( 73e461...5c7825 )
by Bas van
02:46
created

Stub::getStreamsSegment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 4
crap 1
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 11 and the first side effect is on line 10.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
namespace Strava\API\Service;
3
4
/**
5
 * Strava stub Service
6
 *
7
 * @author Bas van Dorst
8
 * @package StravaPHP
9
 */
10
class Stub implements ServiceInterface {
0 ignored issues
show
Bug introduced by
Possible parse error: class missing opening or closing brace
Loading history...
11 1
    public function getAthlete($id = null) {
12 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 }';
13 1
        return $this->format($json);
14
    }
15
16 1
    public function getAthleteStats($id) {
17 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} } ]';
18 1
        return $this->format($json);
19
    }
20
21 1
    public function getAthleteClubs() {
22 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" } ]';
23 1
        return $this->format($json);
24
    }
25
26 1
    public function getAthleteActivities($before = null, $after = null, $page = null, $per_page = null) {
27 1
        $json = '{"response": 1}';
28 1
        return $this->format($json);
29
    }
30
31 1
    public function getAthleteFriends($id = null, $page = null, $per_page = null) {
32 1
        $json = '{"response": 1}';
33 1
        return $this->format($json);
34
    }
35
36 1
    public function getAthleteFollowers($id = null, $page = null, $per_page = null) {
37 1
        $json = '{"response": 1}';
38 1
        return $this->format($json);
39
    }
40
41 1
    public function getAthleteBothFollowing($id, $page = null, $per_page = null) {
42 1
        $json = '{"response": 1}';
43 1
        return $this->format($json);
44
    }
45
46 1
    public function getAthleteKom($id, $page = null, $per_page = null) {
47 1
        $json = '{"response": 1}';
48 1
        return $this->format($json);
49
    }
50
51 1
    public function getAthleteStarredSegments($id = null, $page = null, $per_page = null) {
52 1
        $json = '{"response": 1}';
53 1
        return $this->format($json);
54
    }
55
56 1
    public function updateAthlete($city, $state, $country, $sex, $weight) {
57 1
        $json = '{"response": 1}';
58 1
        return $this->format($json);
59
    }
60
61 1
    public function getActivity($id, $include_all_efforts = null) {
62 1
        $json = '{"response": 1}';
63 1
        return $this->format($json);
64
    }
65
66 1
    public function getActivityComments($id, $markdown = null, $page = null, $per_page = null) {
67 1
        $json = '{"response": 1}';
68 1
        return $this->format($json);
69
    }
70
71 1
    public function getActivityKudos($id, $page = null, $per_page = null) {
72 1
        $json = '{"response": 1}';
73 1
        return $this->format($json);
74
    }
75
<<<<<<< HEAD
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_SL, expecting T_FUNCTION
Loading history...
76 1
77 1
    public function getActivityPhotos($id) {
78 1
=======
79
    
80
    public function getActivityPhotos($id, $size = 2048, $photo_sources = 'true') {
81 1
>>>>>>> 94e968d15abc532c8d1a72b67eb1c90d06ca01b8
82 1
        $json = '{"response": 1}';
83 1
        return $this->format($json);
84
    }
85
86 1
    public function getActivityZones($id) {
87 1
        $json = '{"response": 1}';
88 1
        return $this->format($json);
89
    }
90
91 1
    public function getActivityLaps($id) {
92 1
        $json = '{"response": 1}';
93 1
        return $this->format($json);
94
    }
95
96 1
    public function getActivityUploadStatus($id) {
97 1
        $json = '{"response": 1}';
98 1
        return $this->format($json);
99
    }
100
101 1
    public function createActivity($name, $type, $start_date_local, $elapsed_time, $description = null, $distance = null) {
102 1
        $json = '{"response": 1}';
103 1
        return $this->format($json);
104
    }
105
106 1
    public function uploadActivity($file, $activity_type = null, $name = null, $description = null, $private = null, $trainer = null, $data_type = null, $external_id = null) {
107 1
        $json = '{"response": 1}';
108 1
        return $this->format($json);
109
    }
110
111 1
    public function updateActivity($id, $name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null) {
112 1
        $json = '{"response": 1}';
113 1
        return $this->format($json);
114
    }
115
116 1
    public function deleteActivity($id) {
117 1
        $json = '{"response": 1}';
118 1
        return $this->format($json);
119
    }
120
121 1
    public function getGear($id) {
122 1
        $json = '{"response": 1}';
123 1
        return $this->format($json);
124
    }
125
126 1
    public function getClub($id) {
127 1
        $json = '{"response": 1}';
128 1
        return $this->format($json);
129
    }
130
131 1
    public function getClubMembers($id, $page = null, $per_page  = null) {
132 1
        $json = '{"response": 1}';
133 1
        return $this->format($json);
134
    }
135
136 1
    public function getClubActivities($id, $page = null, $per_page  = null) {
137 1
        $json = '{"response": 1}';
138 1
        return $this->format($json);
139
    }
140
141 1
    public function getClubAnnouncements($id) {
142 1
        $json = '{"response": 1}';
143 1
        return $this->format($json);
144
    }
145
146 1
    public function getClubGroupEvents($id) {
147 1
        $json = '{"response": 1}';
148 1
        return $this->format($json);
149
    }
150
151 1
    public function joinClub($id) {
152 1
        $json = '{"response": 1}';
153 1
        return $this->format($json);
154
    }
155
156 1
    public function leaveClub($id) {
157 1
        $json = '{"response": 1}';
158 1
        return $this->format($json);
159
    }
160
161 1
    public function getSegment($id) {
162 1
        $json = '{"response": 1}';
163 1
        return $this->format($json);
164
    }
165
166 1
    public function getSegmentLeaderboard($id, $gender = null, $age_group = null, $weight_class = null, $following = null, $club_id = null, $date_range = null, $page = null, $per_page = null) {
167 1
        $json = '{"response": 1}';
168 1
        return $this->format($json);
169
    }
170
171 1
    public function getSegmentExplorer($bounds, $activity_type = 'riding', $min_cat = null, $max_cat = null) {
172 1
        $json = '{"response": 1}';
173 1
        return $this->format($json);
174
    }
175
176 1
    public function getSegmentEffort($id, $athlete_id = null, $start_date_local = null, $end_date_local = null, $page = null, $per_page = null) {
177 1
        $json = '{"response": 1}';
178 1
        return $this->format($json);
179
    }
180
181 1
    public function getStreamsActivity($id, $types, $resolution = 'all', $series_type = 'distance') {
182 1
        $json = '{"response": 1}';
183 1
        return $this->format($json);
184
    }
185
186 1
    public function getStreamsEffort($id, $types, $resolution = 'all', $series_type = 'distance') {
187 1
        $json = '{"response": 1}';
188 1
        return $this->format($json);
189
    }
190
191
    public function getStreamsSegment($id, $types, $resolution = 'all', $series_type = 'distance') {
192
        $json = '{"response": 1}';
193
        return $this->format($json);
194 36
    }
195 36
196
    /**
197
     * @param string $result
198
     */
199
    private function format($result) {
200
        return json_decode($result,true);
201
    }
202
}
203