GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( bce16d...c0405e )
by Igor
10:03 queued 08:23
created
src/Route4Me/V5/RecurringRoutes/PageInfo.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -13,72 +13,72 @@
 block discarded – undo
13 13
  */
14 14
 class PageInfo extends Common
15 15
 {
16
-    /**
17
-     * URL of first page
18
-     */
19
-    public ?string $url_of_first_page = null;
16
+	/**
17
+	 * URL of first page
18
+	 */
19
+	public ?string $url_of_first_page = null;
20 20
 
21
-    /**
22
-     * URL of last page
23
-     */
24
-    public ?string $url_of_last_page = null;
21
+	/**
22
+	 * URL of last page
23
+	 */
24
+	public ?string $url_of_last_page = null;
25 25
 
26
-    /**
27
-     * URL of previous page
28
-     */
29
-    public ?string $url_of_previous_page = null;
26
+	/**
27
+	 * URL of previous page
28
+	 */
29
+	public ?string $url_of_previous_page = null;
30 30
 
31
-    /**
32
-     * URL of next page
33
-     */
34
-    public ?string $url_of_next_page = null;
31
+	/**
32
+	 * URL of next page
33
+	 */
34
+	public ?string $url_of_next_page = null;
35 35
 
36
-    /**
37
-     * Number of current page
38
-     */
39
-    public ?int $number_of_current_page = null;
36
+	/**
37
+	 * Number of current page
38
+	 */
39
+	public ?int $number_of_current_page = null;
40 40
 
41
-    /**
42
-     * Number of last page
43
-     */
44
-    public ?int $number_of_last_page = null;
41
+	/**
42
+	 * Number of last page
43
+	 */
44
+	public ?int $number_of_last_page = null;
45 45
 
46
-    /**
47
-     * Items per page
48
-     */
49
-    public ?int $items_per_page = null;
46
+	/**
47
+	 * Items per page
48
+	 */
49
+	public ?int $items_per_page = null;
50 50
 
51
-    /**
52
-     * Index of first item on page
53
-     */
54
-    public ?int $index_of_first = null;
51
+	/**
52
+	 * Index of first item on page
53
+	 */
54
+	public ?int $index_of_first = null;
55 55
 
56
-    /**
57
-     * Index of last item on page
58
-     */
59
-    public ?int $index_of_last = null;
56
+	/**
57
+	 * Index of last item on page
58
+	 */
59
+	public ?int $index_of_last = null;
60 60
 
61
-    /**
62
-     * Total items
63
-     */
64
-    public ?int $total_items = null;
61
+	/**
62
+	 * Total items
63
+	 */
64
+	public ?int $total_items = null;
65 65
 
66
-    public function __construct(array $links = null, array $meta = null)
67
-    {
68
-        if ($links !== null && is_array($links)) {
69
-            $this->url_of_first_page = Common::getValue($links, 'first');
70
-            $this->url_of_last_page = Common::getValue($links, 'last');
71
-            $this->url_of_previous_page = Common::getValue($links, 'prev');
72
-            $this->url_of_next_page = Common::getValue($links, 'next');
73
-        }
66
+	public function __construct(array $links = null, array $meta = null)
67
+	{
68
+		if ($links !== null && is_array($links)) {
69
+			$this->url_of_first_page = Common::getValue($links, 'first');
70
+			$this->url_of_last_page = Common::getValue($links, 'last');
71
+			$this->url_of_previous_page = Common::getValue($links, 'prev');
72
+			$this->url_of_next_page = Common::getValue($links, 'next');
73
+		}
74 74
 
75
-        if ($meta !== null && is_array($meta)) {
76
-            $this->number_of_current_page = Common::getValue($meta, 'current_page');
77
-            $this->number_of_last_page = Common::getValue($meta, 'last_page');
78
-            $this->items_per_page = Common::getValue($meta, 'per_page');
79
-            $this->index_of_first = Common::getValue($meta, 'from');
80
-            $this->index_of_last = Common::getValue($meta, 'to');
81
-            $this->total_items = Common::getValue($meta, 'total');
82
-        }
83
-    }
75
+		if ($meta !== null && is_array($meta)) {
76
+			$this->number_of_current_page = Common::getValue($meta, 'current_page');
77
+			$this->number_of_last_page = Common::getValue($meta, 'last_page');
78
+			$this->items_per_page = Common::getValue($meta, 'per_page');
79
+			$this->index_of_first = Common::getValue($meta, 'from');
80
+			$this->index_of_last = Common::getValue($meta, 'to');
81
+			$this->total_items = Common::getValue($meta, 'total');
82
+		}
83
+	}
84 84
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@
 block discarded – undo
65 65
 
66 66
     public function __construct(array $links = null, array $meta = null)
67 67
     {
68
-        if ($links !== null && is_array($links)) {
68
+        if ($links!==null && is_array($links)) {
69 69
             $this->url_of_first_page = Common::getValue($links, 'first');
70 70
             $this->url_of_last_page = Common::getValue($links, 'last');
71 71
             $this->url_of_previous_page = Common::getValue($links, 'prev');
72 72
             $this->url_of_next_page = Common::getValue($links, 'next');
73 73
         }
74 74
 
75
-        if ($meta !== null && is_array($meta)) {
75
+        if ($meta!==null && is_array($meta)) {
76 76
             $this->number_of_current_page = Common::getValue($meta, 'current_page');
77 77
             $this->number_of_last_page = Common::getValue($meta, 'last_page');
78 78
             $this->items_per_page = Common::getValue($meta, 'per_page');
Please login to merge, or discard this patch.
src/Route4Me/V5/RecurringRoutes/Schedule.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,40 +13,40 @@
 block discarded – undo
13 13
  */
14 14
 class Schedule extends Common
15 15
 {
16
-    /**
17
-     * The Schedule ID
18
-     */
19
-    public ?string $schedule_uid = null;
20
-
21
-    /**
22
-     * The name of Schedule
23
-     */
24
-    public ?string $name = null;
25
-
26
-    /**
27
-     * Array of blacklisted dates as string 'YYYY-MM-DD'.
28
-     */
29
-    public ?array $schedule_blacklist = null;
30
-
31
-    public int $advance_interval = 1;
32
-
33
-    public int $advance_schedule_interval_days = 0;
34
-
35
-    /**
36
-     * Schedule as JSON string
37
-     * e.g. '{"enabled":true,"mode":"daily","daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}'
38
-     */
39
-    public ?string $schedule = null;
40
-
41
-    /**
42
-     * Timezone as 'America/New_York'.
43
-     */
44
-    public ?string $timezone = null;
45
-
46
-    public function __construct(?array $params = null)
47
-    {
48
-        if ($params !== null) {
49
-            $this->fillFromArray($params);
50
-        }
51
-    }
16
+	/**
17
+	 * The Schedule ID
18
+	 */
19
+	public ?string $schedule_uid = null;
20
+
21
+	/**
22
+	 * The name of Schedule
23
+	 */
24
+	public ?string $name = null;
25
+
26
+	/**
27
+	 * Array of blacklisted dates as string 'YYYY-MM-DD'.
28
+	 */
29
+	public ?array $schedule_blacklist = null;
30
+
31
+	public int $advance_interval = 1;
32
+
33
+	public int $advance_schedule_interval_days = 0;
34
+
35
+	/**
36
+	 * Schedule as JSON string
37
+	 * e.g. '{"enabled":true,"mode":"daily","daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}'
38
+	 */
39
+	public ?string $schedule = null;
40
+
41
+	/**
42
+	 * Timezone as 'America/New_York'.
43
+	 */
44
+	public ?string $timezone = null;
45
+
46
+	public function __construct(?array $params = null)
47
+	{
48
+		if ($params !== null) {
49
+			$this->fillFromArray($params);
50
+		}
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
     public function __construct(?array $params = null)
47 47
     {
48
-        if ($params !== null) {
48
+        if ($params!==null) {
49 49
             $this->fillFromArray($params);
50 50
         }
51 51
     }
Please login to merge, or discard this patch.
src/Route4Me/V5/RecurringRoutes/Schedules.php 2 patches
Indentation   +494 added lines, -494 removed lines patch added patch discarded remove patch
@@ -19,498 +19,498 @@
 block discarded – undo
19 19
  */
20 20
 class Schedules extends Common
21 21
 {
22
-    public function __construct()
23
-    {
24
-        Route4Me::setBaseUrl('');
25
-    }
26
-
27
-    /**
28
-     * Create a new Schedule by sending the corresponding data.
29
-     *
30
-     * @since 1.2.3
31
-     *
32
-     * @param  array    $params
33
-     *   string   schedule_uid - Schedule ID,
34
-     *   int      root_member_id,
35
-     *   string   name - Name of Schedule,
36
-     *   string[] schedule_blacklist - An array of blacklisted dates as 'YYYY-MM-DD',
37
-     *   int      advance_interval,
38
-     *   int      advance_schedule_interval_days,
39
-     *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
40
-     *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
41
-     *   string   timezone - Timezone as 'America/New_York'
42
-     * @return Schedule
43
-     * @throws Exception\ApiError
44
-     */
45
-    public function createSchedule(array $params) : Schedule
46
-    {
47
-        $allBodyFields = ['schedule_uid', 'root_member_id', 'name', 'schedule_blacklist',
48
-            'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
49
-
50
-        return $this->toSchedule(Route4Me::makeRequst([
51
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES,
52
-            'method' => 'POST',
53
-            'HTTPHEADER' => 'Content-Type: application/json',
54
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
55
-        ]));
56
-    }
57
-
58
-    /**
59
-     * Get the Schedule by specifying the Schedule ID.
60
-     *
61
-     * @since 1.2.3
62
-     *
63
-     * @param  string $scheduleId Schedule ID.
64
-     * @return Schedule
65
-     * @throws Exception\ApiError
66
-     */
67
-    public function getSchedule(string $scheduleId) : Schedule
68
-    {
69
-        return $this->toSchedule(Route4Me::makeRequst([
70
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
71
-            'method' => 'GET'
72
-        ]));
73
-    }
74
-
75
-    /**
76
-     * Get the list of all Schedules.
77
-     *
78
-     * @since 1.2.3
79
-     *
80
-     * @return Schedule[]
81
-      * @throws Exception\ApiError
82
-    */
83
-    public function getAllSchedules() : array
84
-    {
85
-        $result = Route4Me::makeRequst([
86
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES,
87
-            'method' => 'GET'
88
-        ]);
89
-
90
-        if (is_array($result) && isset($result['data'])) {
91
-            $data = $result['data'];
92
-            if (is_array($data) && isset($data[0]) && is_array($data[0])) {
93
-                $arr = [];
94
-                foreach ($data as $key => $value) {
95
-                    array_push($arr, new Schedule($value));
96
-                }
97
-                return $arr;
98
-            }
99
-        }
100
-        return null;
101
-    }
102
-
103
-    /**
104
-     * Get paginated list of Schedules.
105
-     *
106
-     * @since 1.2.3
107
-     *
108
-     * @param  int   $page Requested page.
109
-     * @param  int   $per_page Number of Schedules per page.
110
-     * @return array
111
-     * @throws Exception\ApiError
112
-     */
113
-    public function getSchedules(int $page = 1, int $per_page = 15) : array
114
-    {
115
-        $result = Route4Me::makeRequst([
116
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES_PAGINATION,
117
-            'method' => 'GET',
118
-            'query' => [
119
-                'with_pagination' => true,
120
-                'page' => $page,
121
-                'per_page' => $per_page
122
-            ]
123
-        ]);
124
-
125
-        if (is_array($result) && isset($result['data'])) {
126
-            $data = $result['data'];
127
-            $schedules = [];
128
-            if (is_array($data) && isset($data[0]) && is_array($data[0])) {
129
-                foreach ($data as $key => $value) {
130
-                    array_push($schedules, new Schedule($value));
131
-                }
132
-            }
133
-            return [
134
-                'schedules' => $schedules,
135
-                'page_info' => new PageInfo($result['links'], $result['meta'])
136
-            ];
137
-        }
138
-        return null;
139
-    }
140
-
141
-    /**
142
-     * Update the existing Schedule by sending the corresponding data.
143
-     *
144
-     * @since 1.2.3
145
-     *
146
-     * @param  string   $schedule_uid Schedule ID
147
-     * @param  array    $params
148
-     *   string   schedule_uid - Schedule ID,
149
-     *   int      root_member_id,
150
-     *   string   name - Name of Schedule,
151
-     *   string[] schedule_blacklist - An array of blacklisted dates as 'YYYY-MM-DD',
152
-     *   int      advance_interval,
153
-     *   int      advance_schedule_interval_days,
154
-     *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
155
-     *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
156
-     *   string   timezone - Timezone as 'America/New_York'
157
-     * @return Schedule
158
-     * @throws Exception\ApiError
159
-     */
160
-    public function updateSchedule(string $scheduleId, array $params) : Schedule
161
-    {
162
-        $allBodyFields = ['root_member_id', 'name', 'schedule_blacklist',
163
-            'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
164
-
165
-        return $this->toSchedule(Route4Me::makeRequst([
166
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
167
-            'method' => 'PUT',
168
-            'HTTPHEADER' => 'Content-Type: application/json',
169
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
170
-        ]));
171
-    }
172
-
173
-    /**
174
-     * Delete the specified Schedule with the option to delete the associated route.
175
-     *
176
-     * @since 1.2.3
177
-     *
178
-     * @param  string $schedule_uid Schedule ID
179
-     * @param  bool   $withRoutes Delete the Schedule that matches the specified Schedule ID.
180
-     *                            If the deleted Schedule has one or multiple associated Routes,
181
-     *                            these Routes are also deleted.
182
-     * @return Schedule
183
-     * @throws Exception\ApiError
184
-     */
185
-    public function deleteSchedule(string $scheduleId, bool $withRoutes = false) : Schedule
186
-    {
187
-        return $this->toSchedule(Route4Me::makeRequst([
188
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
189
-            'method' => 'DELETE',
190
-            'query' => ['with_routes' => $withRoutes]
191
-        ]));
192
-    }
193
-
194
-    /**
195
-     * Create a new Route Schedule by sending the corresponding data.
196
-     *
197
-     * @since 1.2.3
198
-     *
199
-     * @param  array  $params
200
-     *   string route_id - Route ID,
201
-     *   string schedule_uid - Schedule ID,
202
-     *   int    member_id - A unique ID of the root member,
203
-     *   string vehicle_id - Vehicle ID
204
-     * @return RouteSchedule
205
-     * @throws Exception\ApiError
206
-     */
207
-    public function createRouteSchedule(array $params) : RouteSchedule
208
-    {
209
-        $allBodyFields = ['route_id', 'schedule_uid', 'member_id', 'vehicle_id'];
210
-
211
-        return $this->toRouteSchedule(Route4Me::makeRequst([
212
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES,
213
-            'method' => 'POST',
214
-            'HTTPHEADER' => 'Content-Type: application/json',
215
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
216
-        ]));
217
-    }
218
-
219
-    /**
220
-     * Get the Route Schedule by specifying the Route ID.
221
-     *
222
-     * @since 1.2.3
223
-     *
224
-     * @param  string $routeId Route ID.
225
-     * @return RouteSchedule
226
-     * @throws Exception\ApiError
227
-     */
228
-    public function getRouteSchedule(string $route_id) : RouteSchedule
229
-    {
230
-        return $this->toRouteSchedule(Route4Me::makeRequst([
231
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
232
-            'method' => 'GET'
233
-        ]));
234
-    }
235
-
236
-    /**
237
-     * Get the list of all Route Schedules.
238
-     *
239
-     * @since 1.2.3
240
-     *
241
-     * @return RouteSchedule[]
242
-     * @throws Exception\ApiError
243
-     */
244
-    public function getAllRouteSchedules() : array
245
-    {
246
-        $result = Route4Me::makeRequst([
247
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES,
248
-            'method' => 'GET'
249
-        ]);
250
-
251
-        if (is_array($result) && isset($result['data'])) {
252
-            $data = $result['data'];
253
-            if (is_array($data) && isset($data[0]) && is_array($data[0])) {
254
-                $arr = [];
255
-                foreach ($data as $key => $value) {
256
-                    array_push($arr, new RouteSchedule($value));
257
-                }
258
-                return $arr;
259
-            }
260
-        }
261
-        return null;
262
-    }
263
-
264
-    /**
265
-     * Get paginated list of Route Schedules.
266
-     *
267
-     * @since 1.2.3
268
-     *
269
-     * @param  int $page Requested page.
270
-     * @param  int $per_page Number of Route Schedules per page.
271
-     * @return array
272
-     * @throws Exception\ApiError
273
-     */
274
-    public function getRouteSchedules(int $page = 1, int $per_page = 15) : array
275
-    {
276
-        $result = Route4Me::makeRequst([
277
-            'url' =>    Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION,
278
-            'method' => 'GET',
279
-            'query' => [
280
-                'with_pagination' => true,
281
-                'page' => $page,
282
-                'per_page' => $per_page
283
-            ]
284
-        ]);
285
-
286
-        if (is_array($result) && isset($result['data'])) {
287
-            $data = $result['data'];
288
-            $route_schedules = [];
289
-            if (is_array($data) && isset($data[0]) && is_array($data[0])) {
290
-                foreach ($data as $key => $value) {
291
-                    array_push($route_schedules, new RouteSchedule($value));
292
-                }
293
-            }
294
-            return [
295
-                'route_schedules' => $route_schedules,
296
-                'page_info' => new PageInfo($result['links'], $result['meta'])
297
-            ];
298
-        }
299
-        return null;
300
-    }
301
-
302
-    /**
303
-     * Update the existing Route Schedule by sending the corresponding data.
304
-     *
305
-     * @since 1.2.3
306
-     *
307
-     * @param  string $route_id Route ID
308
-     * @param  array  $params
309
-     *   string schedule_uid - Schedule ID,
310
-     *   int    member_id - A unique ID of the root member,
311
-     *   string vehicle_id - Vehicle ID
312
-     * @return RouteSchedule
313
-     * @throws Exception\ApiError
314
-     */
315
-    public function updateRouteSchedule(string $route_id, array $params) : RouteSchedule
316
-    {
317
-        $allBodyFields = ['schedule_uid', 'member_id', 'vehicle_id'];
318
-
319
-        return $this->toRouteSchedule(Route4Me::makeRequst([
320
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
321
-            'method' => 'PUT',
322
-            'HTTPHEADER' => 'Content-Type: application/json',
323
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
324
-        ]));
325
-    }
326
-
327
-    /**
328
-     * Delete the Route Schedules.
329
-     * @todo request return true instead of return json status
330
-     *
331
-     * @since 1.2.3
332
-     *
333
-     * @param  string $route_id Route ID
334
-     * @return bool
335
-     * @throws Exception\ApiError
336
-     */
337
-    public function deleteRouteSchedules(string $route_id) : bool
338
-    {
339
-        $result = Route4Me::makeRequst([
340
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
341
-            'method' => 'DELETE'
342
-        ]);
343
-        return ($result == 1 ? true : false);
344
-    }
345
-
346
-    /**
347
-     * Delete the specified Route Schedule.
348
-     *
349
-     * @since 1.2.3
350
-     *
351
-     * @param  string $route_id Route ID
352
-     * @return RouteSchedule
353
-     * @throws Exception\ApiError
354
-     */
355
-    public function deleteRouteSchedule(string $route_id) : RouteSchedule
356
-    {
357
-        return $this->toRouteSchedule(Route4Me::makeRequst([
358
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id  . '/items',
359
-            'method' => 'DELETE'
360
-        ]));
361
-    }
362
-
363
-    /**
364
-     * Replace the existing Route Schedule by sending the corresponding data.
365
-     *
366
-     * @since 1.2.3
367
-     *
368
-     * @param  string   $route_id Route ID.
369
-     * @param  array    $params
370
-     *   int      member_id - A unique ID of the root member,
371
-     *   string   vehicle_id - Vehicle ID,
372
-     *   string   schedule_uid - Schedule ID,
373
-     *   string   name,
374
-     *   string[] schedule_blacklist - Blacklisted dates as YYYY-MM-DD,
375
-     *   int      advance_interval,
376
-     *   int      advance_schedule_interval_days,
377
-     *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
378
-     *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
379
-     *   string   timezone - Timezone as 'America/New_York'
380
-     * @return RouteSchedule
381
-     * @throws Exception\ApiError
382
-     */
383
-    public function replaceRouteSchedule(string $route_id, array $params)
384
-    {
385
-        $allBodyFields = ['member_id', 'vehicle_id', 'schedule_uid', 'name', 'schedule_blacklist',
386
-            'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
387
-
388
-        return $this->toRouteSchedule(Route4Me::makeRequst([
389
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE . '/' . $route_id,
390
-            'method' => 'PUT',
391
-            'HTTPHEADER' => 'Content-Type: application/json',
392
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
393
-        ]));
394
-    }
395
-
396
-    /**
397
-     * Get the Route Schedule preview by specifying the 'route_id'.
398
-     *
399
-     * @since 1.2.3
400
-     *
401
-     * @param  string $routeId Route ID.
402
-     * @param  string $start Start date as 'YYYY-MM-DD'
403
-     * @param  string $end End date as 'YYYY-MM-DD'
404
-     * @return array
405
-     * @throws Exception\ApiError
406
-     */
407
-    public function getRouteSchedulePreview(string $route_id, string $start, string $end) : array
408
-    {
409
-        return Route4Me::makeRequst([
410
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id . '/preview',
411
-            'method' => 'GET',
412
-            'query' => ['start' => $start, 'end' => $end]
413
-        ]);
414
-    }
415
-
416
-    /**
417
-     * Check if the Scheduled Route was copied by specifying the 'route_id'.
418
-     * @todo request return true instead of return json status
419
-     *
420
-     * @since 1.2.3
421
-     *
422
-     * @param  string $routeId Route ID.
423
-     * @return bool
424
-     * @throws Exception\ApiError
425
-     */
426
-    public function isScheduledRouteCopy(string $route_id) : bool
427
-    {
428
-        return Route4Me::makeRequst([
429
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY . '/' . $route_id,
430
-            'method' => 'GET'
431
-        ]);
432
-    }
433
-
434
-    /**
435
-     * Get all routes copied from the specified Scheduled Route by sending
436
-     * the corresponding data.
437
-     *
438
-     * @since 1.2.3
439
-     *
440
-     * @param  string   $route_id Route ID.
441
-     * @param  string   $schedule_uid Schedule ID.
442
-     * @param  string   $route_date Route date as 'YYYY-MM-DD'.
443
-     * @return array
444
-     * @throws Exception\ApiError
445
-     */
446
-    public function getScheduledRoutesCopies(string $route_id, string $schedule_uid, string $route_date) : array
447
-    {
448
-        return Route4Me::makeRequst([
449
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES,
450
-            'method' => 'POST',
451
-            'HTTPHEADER' => 'Content-Type: application/json',
452
-            'body' => [
453
-                'route_id' => $route_id,
454
-                'schedule_uid' => $schedule_uid,
455
-                'route_date' => $route_date
456
-            ]
457
-        ]);
458
-    }
459
-
460
-    /**
461
-     * Create a new Master Route by sending the corresponding data.
462
-     * @todo request return true instead of return json status
463
-     *
464
-     * @since 1.2.3
465
-     *
466
-     * @param  array    $params
467
-     *   string   route_id - Route ID,
468
-     *   string   route_name,
469
-     *   int      member_id - A unique ID of the root member,
470
-     *   string   vehicle_id - Vehicle ID,
471
-     *   string   schedule_uid - Schedule ID,
472
-     *   string   name,
473
-     *   string[] schedule_blacklist - Blacklisted dates as YYYY-MM-DD,
474
-     *   int      advance_interval,
475
-     *   int      advance_schedule_interval_days,
476
-     *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
477
-     *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
478
-     *   string   timezone - Timezone as 'America/New_York'
479
-     * @return bool
480
-     * @throws Exception\ApiError
481
-     */
482
-    public function createMasterRoute(array $params) : bool
483
-    {
484
-        $allBodyFields = ['route_id', 'route_name', 'member_id', 'schedule_uid', 'vehicle_id', 'name',
485
-            'schedule_blacklist', 'advance_schedule_interval_days', 'schedule', 'timezone'];
486
-
487
-        return Route4Me::makeRequst([
488
-            'url' => Endpoint::RECURRING_ROUTES_MASTER_ROUTES,
489
-            'method' => 'POST',
490
-            'HTTPHEADER' => 'Content-Type: application/json',
491
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
492
-        ]);
493
-    }
494
-
495
-    private function toSchedule($result) : Schedule
496
-    {
497
-        if (is_array($result) && isset($result['data'])) {
498
-            $data = $result['data'];
499
-            if (is_array($data) && isset($data[0]) && is_array($data[0])) {
500
-                return new Schedule($data[0]);
501
-            }
502
-        }
503
-        throw new ApiError('Can not convert result to Schedule object.');
504
-    }
505
-
506
-    private function toRouteSchedule($result) : RouteSchedule
507
-    {
508
-        if (is_array($result) && isset($result['data'])) {
509
-            $data = $result['data'];
510
-            if (is_array($data) && isset($data[0]) && is_array($data[0])) {
511
-                return new RouteSchedule($data[0]);
512
-            }
513
-        }
514
-        throw new ApiError('Can not convert result to RouteSchedule object.');
515
-    }
22
+	public function __construct()
23
+	{
24
+		Route4Me::setBaseUrl('');
25
+	}
26
+
27
+	/**
28
+	 * Create a new Schedule by sending the corresponding data.
29
+	 *
30
+	 * @since 1.2.3
31
+	 *
32
+	 * @param  array    $params
33
+	 *   string   schedule_uid - Schedule ID,
34
+	 *   int      root_member_id,
35
+	 *   string   name - Name of Schedule,
36
+	 *   string[] schedule_blacklist - An array of blacklisted dates as 'YYYY-MM-DD',
37
+	 *   int      advance_interval,
38
+	 *   int      advance_schedule_interval_days,
39
+	 *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
40
+	 *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
41
+	 *   string   timezone - Timezone as 'America/New_York'
42
+	 * @return Schedule
43
+	 * @throws Exception\ApiError
44
+	 */
45
+	public function createSchedule(array $params) : Schedule
46
+	{
47
+		$allBodyFields = ['schedule_uid', 'root_member_id', 'name', 'schedule_blacklist',
48
+			'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
49
+
50
+		return $this->toSchedule(Route4Me::makeRequst([
51
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULES,
52
+			'method' => 'POST',
53
+			'HTTPHEADER' => 'Content-Type: application/json',
54
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
55
+		]));
56
+	}
57
+
58
+	/**
59
+	 * Get the Schedule by specifying the Schedule ID.
60
+	 *
61
+	 * @since 1.2.3
62
+	 *
63
+	 * @param  string $scheduleId Schedule ID.
64
+	 * @return Schedule
65
+	 * @throws Exception\ApiError
66
+	 */
67
+	public function getSchedule(string $scheduleId) : Schedule
68
+	{
69
+		return $this->toSchedule(Route4Me::makeRequst([
70
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
71
+			'method' => 'GET'
72
+		]));
73
+	}
74
+
75
+	/**
76
+	 * Get the list of all Schedules.
77
+	 *
78
+	 * @since 1.2.3
79
+	 *
80
+	 * @return Schedule[]
81
+	 * @throws Exception\ApiError
82
+	 */
83
+	public function getAllSchedules() : array
84
+	{
85
+		$result = Route4Me::makeRequst([
86
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULES,
87
+			'method' => 'GET'
88
+		]);
89
+
90
+		if (is_array($result) && isset($result['data'])) {
91
+			$data = $result['data'];
92
+			if (is_array($data) && isset($data[0]) && is_array($data[0])) {
93
+				$arr = [];
94
+				foreach ($data as $key => $value) {
95
+					array_push($arr, new Schedule($value));
96
+				}
97
+				return $arr;
98
+			}
99
+		}
100
+		return null;
101
+	}
102
+
103
+	/**
104
+	 * Get paginated list of Schedules.
105
+	 *
106
+	 * @since 1.2.3
107
+	 *
108
+	 * @param  int   $page Requested page.
109
+	 * @param  int   $per_page Number of Schedules per page.
110
+	 * @return array
111
+	 * @throws Exception\ApiError
112
+	 */
113
+	public function getSchedules(int $page = 1, int $per_page = 15) : array
114
+	{
115
+		$result = Route4Me::makeRequst([
116
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULES_PAGINATION,
117
+			'method' => 'GET',
118
+			'query' => [
119
+				'with_pagination' => true,
120
+				'page' => $page,
121
+				'per_page' => $per_page
122
+			]
123
+		]);
124
+
125
+		if (is_array($result) && isset($result['data'])) {
126
+			$data = $result['data'];
127
+			$schedules = [];
128
+			if (is_array($data) && isset($data[0]) && is_array($data[0])) {
129
+				foreach ($data as $key => $value) {
130
+					array_push($schedules, new Schedule($value));
131
+				}
132
+			}
133
+			return [
134
+				'schedules' => $schedules,
135
+				'page_info' => new PageInfo($result['links'], $result['meta'])
136
+			];
137
+		}
138
+		return null;
139
+	}
140
+
141
+	/**
142
+	 * Update the existing Schedule by sending the corresponding data.
143
+	 *
144
+	 * @since 1.2.3
145
+	 *
146
+	 * @param  string   $schedule_uid Schedule ID
147
+	 * @param  array    $params
148
+	 *   string   schedule_uid - Schedule ID,
149
+	 *   int      root_member_id,
150
+	 *   string   name - Name of Schedule,
151
+	 *   string[] schedule_blacklist - An array of blacklisted dates as 'YYYY-MM-DD',
152
+	 *   int      advance_interval,
153
+	 *   int      advance_schedule_interval_days,
154
+	 *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
155
+	 *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
156
+	 *   string   timezone - Timezone as 'America/New_York'
157
+	 * @return Schedule
158
+	 * @throws Exception\ApiError
159
+	 */
160
+	public function updateSchedule(string $scheduleId, array $params) : Schedule
161
+	{
162
+		$allBodyFields = ['root_member_id', 'name', 'schedule_blacklist',
163
+			'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
164
+
165
+		return $this->toSchedule(Route4Me::makeRequst([
166
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
167
+			'method' => 'PUT',
168
+			'HTTPHEADER' => 'Content-Type: application/json',
169
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
170
+		]));
171
+	}
172
+
173
+	/**
174
+	 * Delete the specified Schedule with the option to delete the associated route.
175
+	 *
176
+	 * @since 1.2.3
177
+	 *
178
+	 * @param  string $schedule_uid Schedule ID
179
+	 * @param  bool   $withRoutes Delete the Schedule that matches the specified Schedule ID.
180
+	 *                            If the deleted Schedule has one or multiple associated Routes,
181
+	 *                            these Routes are also deleted.
182
+	 * @return Schedule
183
+	 * @throws Exception\ApiError
184
+	 */
185
+	public function deleteSchedule(string $scheduleId, bool $withRoutes = false) : Schedule
186
+	{
187
+		return $this->toSchedule(Route4Me::makeRequst([
188
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
189
+			'method' => 'DELETE',
190
+			'query' => ['with_routes' => $withRoutes]
191
+		]));
192
+	}
193
+
194
+	/**
195
+	 * Create a new Route Schedule by sending the corresponding data.
196
+	 *
197
+	 * @since 1.2.3
198
+	 *
199
+	 * @param  array  $params
200
+	 *   string route_id - Route ID,
201
+	 *   string schedule_uid - Schedule ID,
202
+	 *   int    member_id - A unique ID of the root member,
203
+	 *   string vehicle_id - Vehicle ID
204
+	 * @return RouteSchedule
205
+	 * @throws Exception\ApiError
206
+	 */
207
+	public function createRouteSchedule(array $params) : RouteSchedule
208
+	{
209
+		$allBodyFields = ['route_id', 'schedule_uid', 'member_id', 'vehicle_id'];
210
+
211
+		return $this->toRouteSchedule(Route4Me::makeRequst([
212
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES,
213
+			'method' => 'POST',
214
+			'HTTPHEADER' => 'Content-Type: application/json',
215
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
216
+		]));
217
+	}
218
+
219
+	/**
220
+	 * Get the Route Schedule by specifying the Route ID.
221
+	 *
222
+	 * @since 1.2.3
223
+	 *
224
+	 * @param  string $routeId Route ID.
225
+	 * @return RouteSchedule
226
+	 * @throws Exception\ApiError
227
+	 */
228
+	public function getRouteSchedule(string $route_id) : RouteSchedule
229
+	{
230
+		return $this->toRouteSchedule(Route4Me::makeRequst([
231
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
232
+			'method' => 'GET'
233
+		]));
234
+	}
235
+
236
+	/**
237
+	 * Get the list of all Route Schedules.
238
+	 *
239
+	 * @since 1.2.3
240
+	 *
241
+	 * @return RouteSchedule[]
242
+	 * @throws Exception\ApiError
243
+	 */
244
+	public function getAllRouteSchedules() : array
245
+	{
246
+		$result = Route4Me::makeRequst([
247
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES,
248
+			'method' => 'GET'
249
+		]);
250
+
251
+		if (is_array($result) && isset($result['data'])) {
252
+			$data = $result['data'];
253
+			if (is_array($data) && isset($data[0]) && is_array($data[0])) {
254
+				$arr = [];
255
+				foreach ($data as $key => $value) {
256
+					array_push($arr, new RouteSchedule($value));
257
+				}
258
+				return $arr;
259
+			}
260
+		}
261
+		return null;
262
+	}
263
+
264
+	/**
265
+	 * Get paginated list of Route Schedules.
266
+	 *
267
+	 * @since 1.2.3
268
+	 *
269
+	 * @param  int $page Requested page.
270
+	 * @param  int $per_page Number of Route Schedules per page.
271
+	 * @return array
272
+	 * @throws Exception\ApiError
273
+	 */
274
+	public function getRouteSchedules(int $page = 1, int $per_page = 15) : array
275
+	{
276
+		$result = Route4Me::makeRequst([
277
+			'url' =>    Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION,
278
+			'method' => 'GET',
279
+			'query' => [
280
+				'with_pagination' => true,
281
+				'page' => $page,
282
+				'per_page' => $per_page
283
+			]
284
+		]);
285
+
286
+		if (is_array($result) && isset($result['data'])) {
287
+			$data = $result['data'];
288
+			$route_schedules = [];
289
+			if (is_array($data) && isset($data[0]) && is_array($data[0])) {
290
+				foreach ($data as $key => $value) {
291
+					array_push($route_schedules, new RouteSchedule($value));
292
+				}
293
+			}
294
+			return [
295
+				'route_schedules' => $route_schedules,
296
+				'page_info' => new PageInfo($result['links'], $result['meta'])
297
+			];
298
+		}
299
+		return null;
300
+	}
301
+
302
+	/**
303
+	 * Update the existing Route Schedule by sending the corresponding data.
304
+	 *
305
+	 * @since 1.2.3
306
+	 *
307
+	 * @param  string $route_id Route ID
308
+	 * @param  array  $params
309
+	 *   string schedule_uid - Schedule ID,
310
+	 *   int    member_id - A unique ID of the root member,
311
+	 *   string vehicle_id - Vehicle ID
312
+	 * @return RouteSchedule
313
+	 * @throws Exception\ApiError
314
+	 */
315
+	public function updateRouteSchedule(string $route_id, array $params) : RouteSchedule
316
+	{
317
+		$allBodyFields = ['schedule_uid', 'member_id', 'vehicle_id'];
318
+
319
+		return $this->toRouteSchedule(Route4Me::makeRequst([
320
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
321
+			'method' => 'PUT',
322
+			'HTTPHEADER' => 'Content-Type: application/json',
323
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
324
+		]));
325
+	}
326
+
327
+	/**
328
+	 * Delete the Route Schedules.
329
+	 * @todo request return true instead of return json status
330
+	 *
331
+	 * @since 1.2.3
332
+	 *
333
+	 * @param  string $route_id Route ID
334
+	 * @return bool
335
+	 * @throws Exception\ApiError
336
+	 */
337
+	public function deleteRouteSchedules(string $route_id) : bool
338
+	{
339
+		$result = Route4Me::makeRequst([
340
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
341
+			'method' => 'DELETE'
342
+		]);
343
+		return ($result == 1 ? true : false);
344
+	}
345
+
346
+	/**
347
+	 * Delete the specified Route Schedule.
348
+	 *
349
+	 * @since 1.2.3
350
+	 *
351
+	 * @param  string $route_id Route ID
352
+	 * @return RouteSchedule
353
+	 * @throws Exception\ApiError
354
+	 */
355
+	public function deleteRouteSchedule(string $route_id) : RouteSchedule
356
+	{
357
+		return $this->toRouteSchedule(Route4Me::makeRequst([
358
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id  . '/items',
359
+			'method' => 'DELETE'
360
+		]));
361
+	}
362
+
363
+	/**
364
+	 * Replace the existing Route Schedule by sending the corresponding data.
365
+	 *
366
+	 * @since 1.2.3
367
+	 *
368
+	 * @param  string   $route_id Route ID.
369
+	 * @param  array    $params
370
+	 *   int      member_id - A unique ID of the root member,
371
+	 *   string   vehicle_id - Vehicle ID,
372
+	 *   string   schedule_uid - Schedule ID,
373
+	 *   string   name,
374
+	 *   string[] schedule_blacklist - Blacklisted dates as YYYY-MM-DD,
375
+	 *   int      advance_interval,
376
+	 *   int      advance_schedule_interval_days,
377
+	 *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
378
+	 *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
379
+	 *   string   timezone - Timezone as 'America/New_York'
380
+	 * @return RouteSchedule
381
+	 * @throws Exception\ApiError
382
+	 */
383
+	public function replaceRouteSchedule(string $route_id, array $params)
384
+	{
385
+		$allBodyFields = ['member_id', 'vehicle_id', 'schedule_uid', 'name', 'schedule_blacklist',
386
+			'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
387
+
388
+		return $this->toRouteSchedule(Route4Me::makeRequst([
389
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE . '/' . $route_id,
390
+			'method' => 'PUT',
391
+			'HTTPHEADER' => 'Content-Type: application/json',
392
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
393
+		]));
394
+	}
395
+
396
+	/**
397
+	 * Get the Route Schedule preview by specifying the 'route_id'.
398
+	 *
399
+	 * @since 1.2.3
400
+	 *
401
+	 * @param  string $routeId Route ID.
402
+	 * @param  string $start Start date as 'YYYY-MM-DD'
403
+	 * @param  string $end End date as 'YYYY-MM-DD'
404
+	 * @return array
405
+	 * @throws Exception\ApiError
406
+	 */
407
+	public function getRouteSchedulePreview(string $route_id, string $start, string $end) : array
408
+	{
409
+		return Route4Me::makeRequst([
410
+			'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id . '/preview',
411
+			'method' => 'GET',
412
+			'query' => ['start' => $start, 'end' => $end]
413
+		]);
414
+	}
415
+
416
+	/**
417
+	 * Check if the Scheduled Route was copied by specifying the 'route_id'.
418
+	 * @todo request return true instead of return json status
419
+	 *
420
+	 * @since 1.2.3
421
+	 *
422
+	 * @param  string $routeId Route ID.
423
+	 * @return bool
424
+	 * @throws Exception\ApiError
425
+	 */
426
+	public function isScheduledRouteCopy(string $route_id) : bool
427
+	{
428
+		return Route4Me::makeRequst([
429
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY . '/' . $route_id,
430
+			'method' => 'GET'
431
+		]);
432
+	}
433
+
434
+	/**
435
+	 * Get all routes copied from the specified Scheduled Route by sending
436
+	 * the corresponding data.
437
+	 *
438
+	 * @since 1.2.3
439
+	 *
440
+	 * @param  string   $route_id Route ID.
441
+	 * @param  string   $schedule_uid Schedule ID.
442
+	 * @param  string   $route_date Route date as 'YYYY-MM-DD'.
443
+	 * @return array
444
+	 * @throws Exception\ApiError
445
+	 */
446
+	public function getScheduledRoutesCopies(string $route_id, string $schedule_uid, string $route_date) : array
447
+	{
448
+		return Route4Me::makeRequst([
449
+			'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES,
450
+			'method' => 'POST',
451
+			'HTTPHEADER' => 'Content-Type: application/json',
452
+			'body' => [
453
+				'route_id' => $route_id,
454
+				'schedule_uid' => $schedule_uid,
455
+				'route_date' => $route_date
456
+			]
457
+		]);
458
+	}
459
+
460
+	/**
461
+	 * Create a new Master Route by sending the corresponding data.
462
+	 * @todo request return true instead of return json status
463
+	 *
464
+	 * @since 1.2.3
465
+	 *
466
+	 * @param  array    $params
467
+	 *   string   route_id - Route ID,
468
+	 *   string   route_name,
469
+	 *   int      member_id - A unique ID of the root member,
470
+	 *   string   vehicle_id - Vehicle ID,
471
+	 *   string   schedule_uid - Schedule ID,
472
+	 *   string   name,
473
+	 *   string[] schedule_blacklist - Blacklisted dates as YYYY-MM-DD,
474
+	 *   int      advance_interval,
475
+	 *   int      advance_schedule_interval_days,
476
+	 *   string   schedule - Schedule as JSON string e.g. '{"enabled":true,"mode":"daily",
477
+	 *                           "daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}',
478
+	 *   string   timezone - Timezone as 'America/New_York'
479
+	 * @return bool
480
+	 * @throws Exception\ApiError
481
+	 */
482
+	public function createMasterRoute(array $params) : bool
483
+	{
484
+		$allBodyFields = ['route_id', 'route_name', 'member_id', 'schedule_uid', 'vehicle_id', 'name',
485
+			'schedule_blacklist', 'advance_schedule_interval_days', 'schedule', 'timezone'];
486
+
487
+		return Route4Me::makeRequst([
488
+			'url' => Endpoint::RECURRING_ROUTES_MASTER_ROUTES,
489
+			'method' => 'POST',
490
+			'HTTPHEADER' => 'Content-Type: application/json',
491
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
492
+		]);
493
+	}
494
+
495
+	private function toSchedule($result) : Schedule
496
+	{
497
+		if (is_array($result) && isset($result['data'])) {
498
+			$data = $result['data'];
499
+			if (is_array($data) && isset($data[0]) && is_array($data[0])) {
500
+				return new Schedule($data[0]);
501
+			}
502
+		}
503
+		throw new ApiError('Can not convert result to Schedule object.');
504
+	}
505
+
506
+	private function toRouteSchedule($result) : RouteSchedule
507
+	{
508
+		if (is_array($result) && isset($result['data'])) {
509
+			$data = $result['data'];
510
+			if (is_array($data) && isset($data[0]) && is_array($data[0])) {
511
+				return new RouteSchedule($data[0]);
512
+			}
513
+		}
514
+		throw new ApiError('Can not convert result to RouteSchedule object.');
515
+	}
516 516
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function getSchedule(string $scheduleId) : Schedule
68 68
     {
69 69
         return $this->toSchedule(Route4Me::makeRequst([
70
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
70
+            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES.'/'.$scheduleId,
71 71
             'method' => 'GET'
72 72
         ]));
73 73
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
164 164
 
165 165
         return $this->toSchedule(Route4Me::makeRequst([
166
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
166
+            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES.'/'.$scheduleId,
167 167
             'method' => 'PUT',
168 168
             'HTTPHEADER' => 'Content-Type: application/json',
169 169
             'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     public function deleteSchedule(string $scheduleId, bool $withRoutes = false) : Schedule
186 186
     {
187 187
         return $this->toSchedule(Route4Me::makeRequst([
188
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId,
188
+            'url' => Endpoint::RECURRING_ROUTES_SCHEDULES.'/'.$scheduleId,
189 189
             'method' => 'DELETE',
190 190
             'query' => ['with_routes' => $withRoutes]
191 191
         ]));
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     public function getRouteSchedule(string $route_id) : RouteSchedule
229 229
     {
230 230
         return $this->toRouteSchedule(Route4Me::makeRequst([
231
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
231
+            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id,
232 232
             'method' => 'GET'
233 233
         ]));
234 234
     }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         $allBodyFields = ['schedule_uid', 'member_id', 'vehicle_id'];
318 318
 
319 319
         return $this->toRouteSchedule(Route4Me::makeRequst([
320
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
320
+            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id,
321 321
             'method' => 'PUT',
322 322
             'HTTPHEADER' => 'Content-Type: application/json',
323 323
             'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
     public function deleteRouteSchedules(string $route_id) : bool
338 338
     {
339 339
         $result = Route4Me::makeRequst([
340
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id,
340
+            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id,
341 341
             'method' => 'DELETE'
342 342
         ]);
343
-        return ($result == 1 ? true : false);
343
+        return ($result==1 ? true : false);
344 344
     }
345 345
 
346 346
     /**
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     public function deleteRouteSchedule(string $route_id) : RouteSchedule
356 356
     {
357 357
         return $this->toRouteSchedule(Route4Me::makeRequst([
358
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id  . '/items',
358
+            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id.'/items',
359 359
             'method' => 'DELETE'
360 360
         ]));
361 361
     }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
             'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone'];
387 387
 
388 388
         return $this->toRouteSchedule(Route4Me::makeRequst([
389
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE . '/' . $route_id,
389
+            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE.'/'.$route_id,
390 390
             'method' => 'PUT',
391 391
             'HTTPHEADER' => 'Content-Type: application/json',
392 392
             'body' => Route4Me::generateRequestParameters($allBodyFields, $params)
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     public function getRouteSchedulePreview(string $route_id, string $start, string $end) : array
408 408
     {
409 409
         return Route4Me::makeRequst([
410
-            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id . '/preview',
410
+            'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id.'/preview',
411 411
             'method' => 'GET',
412 412
             'query' => ['start' => $start, 'end' => $end]
413 413
         ]);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
     public function isScheduledRouteCopy(string $route_id) : bool
427 427
     {
428 428
         return Route4Me::makeRequst([
429
-            'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY . '/' . $route_id,
429
+            'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY.'/'.$route_id,
430 430
             'method' => 'GET'
431 431
         ]);
432 432
     }
Please login to merge, or discard this patch.
src/Route4Me/Common.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@
 block discarded – undo
4 4
 
5 5
 class Common
6 6
 {
7
-    public static function getValue($array, $item, $default = null)
8
-    {
9
-        return (isset($array[$item])) ? $array[$item] : $default;
10
-    }
7
+	public static function getValue($array, $item, $default = null)
8
+	{
9
+		return (isset($array[$item])) ? $array[$item] : $default;
10
+	}
11 11
 
12
-    public function toArray()
13
-    {
14
-        $params = array_filter(get_object_vars($this), function ($item) {
15
-            return (null !== $item) && !(is_array($item) && !count($item));
16
-        });
12
+	public function toArray()
13
+	{
14
+		$params = array_filter(get_object_vars($this), function ($item) {
15
+			return (null !== $item) && !(is_array($item) && !count($item));
16
+		});
17 17
 
18
-        return $params;
19
-    }
18
+		return $params;
19
+	}
20 20
 
21
-    protected function fillFromArray(array $params)
22
-    {
23
-        foreach ($this as $key => $value) {
24
-            if (isset($params[$key])) {
25
-                $this->{$key} = $params[$key];
26
-            }
27
-        }
28
-    }
21
+	protected function fillFromArray(array $params)
22
+	{
23
+		foreach ($this as $key => $value) {
24
+			if (isset($params[$key])) {
25
+				$this->{$key} = $params[$key];
26
+			}
27
+		}
28
+	}
29 29
 }
Please login to merge, or discard this patch.