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.
Completed
Push — master ( 8dd986...688c26 )
by Eric
04:44
created

DirectionLeg   C

Complexity

Total Complexity 39

Size/Duplication

Total Lines 360
Duplicated Lines 0 %

Coupling/Cohesion

Components 11
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 39
c 1
b 0
f 0
lcom 11
cbo 0
dl 0
loc 360
rs 5.2727

37 Methods

Rating   Name   Duplication   Size   Complexity  
A hasDistance() 0 4 1
A getDistance() 0 4 1
A setDistance() 0 4 1
A hasDuration() 0 4 1
A getDuration() 0 4 1
A setDuration() 0 4 1
A hasDurationInTraffic() 0 4 1
A getDurationInTraffic() 0 4 1
A setDurationInTraffic() 0 4 1
A hasArrivalTime() 0 4 1
A getArrivalTime() 0 4 1
A setArrivalTime() 0 4 1
A hasDepartureTime() 0 4 1
A getDepartureTime() 0 4 1
A setDepartureTime() 0 4 1
A hasEndAddress() 0 4 1
A getEndAddress() 0 4 1
A setEndAddress() 0 4 1
A hasEndLocation() 0 4 1
A getEndLocation() 0 4 1
A setEndLocation() 0 4 1
A hasStartAddress() 0 4 1
A getStartAddress() 0 4 1
A setStartAddress() 0 4 1
A hasStartLocation() 0 4 1
A getStartLocation() 0 4 1
A setStartLocation() 0 4 1
A hasSteps() 0 4 1
A getSteps() 0 4 1
A setSteps() 0 5 1
A addSteps() 0 6 2
A hasStep() 0 4 1
A addStep() 0 6 2
A removeStep() 0 4 1
A hasViaWaypoints() 0 4 1
A getViaWaypoints() 0 4 1
A setViaWaypoints() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Service\Direction\Response;
13
14
use Ivory\GoogleMap\Base\Coordinate;
15
use Ivory\GoogleMap\Service\Base\Distance;
16
use Ivory\GoogleMap\Service\Base\Duration;
17
18
/**
19
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionLeg
20
 *
21
 * @author GeLo <[email protected]>
22
 */
23
class DirectionLeg
24
{
25
    /**
26
     * @var Distance|null
27
     */
28
    private $distance;
29
30
    /**
31
     * @var Duration|null
32
     */
33
    private $duration;
34
35
    /**
36
     * @var Duration|null
37
     */
38
    private $durationInTraffic;
39
40
    /**
41
     * @var \DateTime|null
42
     */
43
    private $arrivalTime;
44
45
    /**
46
     * @var \DateTime|null
47
     */
48
    private $departureTime;
49
50
    /**
51
     * @var string|null
52
     */
53
    private $endAddress;
54
55
    /**
56
     * @var Coordinate|null
57
     */
58
    private $endLocation;
59
60
    /**
61
     * @var string|null
62
     */
63
    private $startAddress;
64
65
    /**
66
     * @var Coordinate|null
67
     */
68
    private $startLocation;
69
70
    /**
71
     * @var DirectionStep[]
72
     */
73
    private $steps = [];
74
75
    /**
76
     * @var mixed[]
77
     */
78
    private $viaWaypoints = [];
79
80
    /**
81
     * @return bool
82
     */
83
    public function hasDistance()
84
    {
85
        return $this->distance !== null;
86
    }
87
88
    /**
89
     * @return Distance|null
90
     */
91
    public function getDistance()
92
    {
93
        return $this->distance;
94
    }
95
96
    /**
97
     * @param Distance|null $distance
98
     */
99
    public function setDistance(Distance $distance = null)
100
    {
101
        $this->distance = $distance;
102
    }
103
104
    /**
105
     * @return bool
106
     */
107
    public function hasDuration()
108
    {
109
        return $this->duration !== null;
110
    }
111
112
    /**
113
     * @return Duration|null
114
     */
115
    public function getDuration()
116
    {
117
        return $this->duration;
118
    }
119
120
    /**
121
     * @param Duration|null $duration
122
     */
123
    public function setDuration(Duration $duration = null)
124
    {
125
        $this->duration = $duration;
126
    }
127
128
    /**
129
     * @return bool
130
     */
131
    public function hasDurationInTraffic()
132
    {
133
        return $this->durationInTraffic !== null;
134
    }
135
136
    /**
137
     * @return Duration|null
138
     */
139
    public function getDurationInTraffic()
140
    {
141
        return $this->durationInTraffic;
142
    }
143
144
    /**
145
     * @param Duration|null $durationInTraffic
146
     */
147
    public function setDurationInTraffic(Duration $durationInTraffic = null)
148
    {
149
        $this->durationInTraffic = $durationInTraffic;
150
    }
151
152
    /**
153
     * @return bool
154
     */
155
    public function hasArrivalTime()
156
    {
157
        return $this->arrivalTime !== null;
158
    }
159
160
    /**
161
     * @return \DateTime|null
162
     */
163
    public function getArrivalTime()
164
    {
165
        return $this->arrivalTime;
166
    }
167
168
    /**
169
     * @param \DateTime|null $arrivalTime
170
     */
171
    public function setArrivalTime(\DateTime $arrivalTime = null)
172
    {
173
        $this->arrivalTime = $arrivalTime;
174
    }
175
176
    /**
177
     * @return bool
178
     */
179
    public function hasDepartureTime()
180
    {
181
        return $this->departureTime !== null;
182
    }
183
184
    /**
185
     * @return \DateTime|null
186
     */
187
    public function getDepartureTime()
188
    {
189
        return $this->departureTime;
190
    }
191
192
    /**
193
     * @param \DateTime|null $departureTime
194
     */
195
    public function setDepartureTime(\DateTime $departureTime = null)
196
    {
197
        $this->departureTime = $departureTime;
198
    }
199
200
    /**
201
     * @return bool
202
     */
203
    public function hasEndAddress()
204
    {
205
        return $this->endAddress !== null;
206
    }
207
208
    /**
209
     * @return string|null
210
     */
211
    public function getEndAddress()
212
    {
213
        return $this->endAddress;
214
    }
215
216
    /**
217
     * @param string|null $endAddress
218
     */
219
    public function setEndAddress($endAddress = null)
220
    {
221
        $this->endAddress = $endAddress;
222
    }
223
224
    /**
225
     * @return bool
226
     */
227
    public function hasEndLocation()
228
    {
229
        return $this->endLocation !== null;
230
    }
231
232
    /**
233
     * @return Coordinate|null
234
     */
235
    public function getEndLocation()
236
    {
237
        return $this->endLocation;
238
    }
239
240
    /**
241
     * @param Coordinate|null $endLocation
242
     */
243
    public function setEndLocation(Coordinate $endLocation = null)
244
    {
245
        $this->endLocation = $endLocation;
246
    }
247
248
    /**
249
     * @return bool
250
     */
251
    public function hasStartAddress()
252
    {
253
        return $this->startAddress !== null;
254
    }
255
256
    /**
257
     * @return string|null
258
     */
259
    public function getStartAddress()
260
    {
261
        return $this->startAddress;
262
    }
263
264
    /**
265
     * @param string|null $startAddress
266
     */
267
    public function setStartAddress($startAddress = null)
268
    {
269
        $this->startAddress = $startAddress;
270
    }
271
272
    /**
273
     * @return bool
274
     */
275
    public function hasStartLocation()
276
    {
277
        return $this->startLocation !== null;
278
    }
279
280
    /**
281
     * @return Coordinate|null
282
     */
283
    public function getStartLocation()
284
    {
285
        return $this->startLocation;
286
    }
287
288
    /**
289
     * @param Coordinate|null $startLocation
290
     */
291
    public function setStartLocation(Coordinate $startLocation = null)
292
    {
293
        $this->startLocation = $startLocation;
294
    }
295
296
    /**
297
     * @return bool
298
     */
299
    public function hasSteps()
300
    {
301
        return !empty($this->steps);
302
    }
303
304
    /**
305
     * @return DirectionStep[]
306
     */
307
    public function getSteps()
308
    {
309
        return $this->steps;
310
    }
311
312
    /**
313
     * @param DirectionStep[] $steps
314
     */
315
    public function setSteps(array $steps)
316
    {
317
        $this->steps = [];
318
        $this->addSteps($steps);
319
    }
320
321
    /**
322
     * @param DirectionStep[] $steps
323
     */
324
    public function addSteps(array $steps)
325
    {
326
        foreach ($steps as $step) {
327
            $this->addStep($step);
328
        }
329
    }
330
331
    /**
332
     * @param DirectionStep $step
333
     *
334
     * @return bool
335
     */
336
    public function hasStep(DirectionStep $step)
337
    {
338
        return in_array($step, $this->steps, true);
339
    }
340
341
    /**
342
     * @param DirectionStep $step
343
     */
344
    public function addStep(DirectionStep $step)
345
    {
346
        if (!$this->hasStep($step)) {
347
            $this->steps[] = $step;
348
        }
349
    }
350
351
    /**
352
     * @param DirectionStep $step
353
     */
354
    public function removeStep(DirectionStep $step)
355
    {
356
        unset($this->steps[array_search($step, $this->steps, true)]);
357
    }
358
359
    /**
360
     * @return bool
361
     */
362
    public function hasViaWaypoints()
363
    {
364
        return !empty($this->viaWaypoints);
365
    }
366
367
    /**
368
     * @return mixed[]
369
     */
370
    public function getViaWaypoints()
371
    {
372
        return $this->viaWaypoints;
373
    }
374
375
    /**
376
     * @param mixed[] $viaWaypoints
377
     */
378
    public function setViaWaypoints(array $viaWaypoints)
379
    {
380
        $this->viaWaypoints = $viaWaypoints;
381
    }
382
}
383