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 — directions-fare ( 5be71a )
by Eric
02:21
created

DirectionsRoute::getBound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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\Directions;
13
14
use Ivory\GoogleMap\Base\Bound;
15
use Ivory\GoogleMap\Overlay\EncodedPolyline;
16
17
/**
18
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionsRoute
19
 *
20
 * @author GeLo <[email protected]>
21
 */
22
class DirectionsRoute
23
{
24
    /**
25
     * @var Bound|null
26
     */
27
    private $bound;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $copyrights;
33
34
    /**
35
     * @var DirectionsLeg[]
36
     */
37
    private $legs = [];
38
39
    /**
40
     * @var EncodedPolyline|null
41
     */
42
    private $overviewPolyline;
43
44
    /**
45
     * @var string|null
46
     */
47
    private $summary;
48
49
    /**
50
     * @var DirectionsFare|null
51
     */
52
    private $fare;
53
54
    /**
55
     * @var string[]
56
     */
57
    private $warnings = [];
58
59
    /**
60
     * @var int[]
61
     */
62
    private $waypointOrders = [];
63
64
    /**
65
     * @return bool
66
     */
67
    public function hasBound()
68
    {
69
        return $this->bound !== null;
70
    }
71
72
    /**
73
     * @return Bound|null
74
     */
75
    public function getBound()
76
    {
77
        return $this->bound;
78
    }
79
80
    /**
81
     * @param Bound|null $bound
82
     */
83
    public function setBound(Bound $bound = null)
84
    {
85
        $this->bound = $bound;
86
    }
87
88
    /**
89
     * @return bool
90
     */
91
    public function hasCopyrights()
92
    {
93
        return $this->copyrights !== null;
94
    }
95
96
    /**
97
     * @return string|null
98
     */
99
    public function getCopyrights()
100
    {
101
        return $this->copyrights;
102
    }
103
104
    /**
105
     * @param string|null $copyrights
106
     */
107
    public function setCopyrights($copyrights = null)
108
    {
109
        $this->copyrights = $copyrights;
110
    }
111
112
    /**
113
     * @return bool
114
     */
115
    public function hasLegs()
116
    {
117
        return !empty($this->legs);
118
    }
119
120
    /**
121
     * @return DirectionsLeg[]
122
     */
123
    public function getLegs()
124
    {
125
        return $this->legs;
126
    }
127
128
    /**
129
     * @param DirectionsLeg[] $legs
130
     */
131
    public function setLegs(array $legs)
132
    {
133
        $this->legs = [];
134
        $this->addLegs($legs);
135
    }
136
137
    /**
138
     * @param DirectionsLeg[] $legs
139
     */
140
    public function addLegs(array $legs)
141
    {
142
        foreach ($legs as $leg) {
143
            $this->addLeg($leg);
144
        }
145
    }
146
147
    /**
148
     * @param DirectionsLeg $leg
149
     *
150
     * @return bool
151
     */
152
    public function hasLeg(DirectionsLeg $leg)
153
    {
154
        return in_array($leg, $this->legs, true);
155
    }
156
157
    /**
158
     * @param DirectionsLeg $leg
159
     */
160
    public function addLeg(DirectionsLeg $leg)
161
    {
162
        if (!$this->hasLeg($leg)) {
163
            $this->legs[] = $leg;
164
        }
165
    }
166
167
    /**
168
     * @param DirectionsLeg $leg
169
     */
170
    public function removeLeg(DirectionsLeg $leg)
171
    {
172
        unset($this->legs[array_search($leg, $this->legs, true)]);
173
        $this->legs = array_values($this->legs);
174
    }
175
176
    /**
177
     * @return bool
178
     */
179
    public function hasOverviewPolyline()
180
    {
181
        return $this->overviewPolyline !== null;
182
    }
183
184
    /**
185
     * @return EncodedPolyline|null
186
     */
187
    public function getOverviewPolyline()
188
    {
189
        return $this->overviewPolyline;
190
    }
191
192
    /**
193
     * @param EncodedPolyline|null $overviewPolyline
194
     */
195
    public function setOverviewPolyline(EncodedPolyline $overviewPolyline = null)
196
    {
197
        $this->overviewPolyline = $overviewPolyline;
198
    }
199
200
    /**
201
     * @return bool
202
     */
203
    public function hasSummary()
204
    {
205
        return $this->summary !== null;
206
    }
207
208
    /**
209
     * @return string|null
210
     */
211
    public function getSummary()
212
    {
213
        return $this->summary;
214
    }
215
216
    /**
217
     * @param string|null $summary
218
     */
219
    public function setSummary($summary = null)
220
    {
221
        $this->summary = $summary;
222
    }
223
224
    /**
225
     * @return bool
226
     */
227
    public function hasFare()
228
    {
229
        return $this->fare !== null;
230
    }
231
232
    /**
233
     * @return DirectionsFare|null
234
     */
235
    public function getFare()
236
    {
237
        return $this->fare;
238
    }
239
240
    /**
241
     * @param DirectionsFare|null $fare
242
     */
243
    public function setFare(DirectionsFare $fare = null)
244
    {
245
        $this->fare = $fare;
246
    }
247
248
    /**
249
     * @return bool
250
     */
251
    public function hasWarnings()
252
    {
253
        return !empty($this->warnings);
254
    }
255
256
    /**
257
     * @return string[]
258
     */
259
    public function getWarnings()
260
    {
261
        return $this->warnings;
262
    }
263
264
    /**
265
     * @param string[] $warnings
266
     */
267
    public function setWarnings(array $warnings)
268
    {
269
        $this->warnings = [];
270
        $this->addWarnings($warnings);
271
    }
272
273
    /**
274
     * @param string[] $warnings
275
     */
276
    public function addWarnings(array $warnings)
277
    {
278
        foreach ($warnings as $warning) {
279
            $this->addWarning($warning);
280
        }
281
    }
282
283
    /**
284
     * @param $warning
285
     *
286
     * @return bool
287
     */
288
    public function hasWarning($warning)
289
    {
290
        return in_array($warning, $this->warnings, true);
291
    }
292
293
    /**
294
     * @param string $warning
295
     */
296
    public function addWarning($warning)
297
    {
298
        if (!$this->hasWarning($warning)) {
299
            $this->warnings[] = $warning;
300
        }
301
    }
302
303
    /**
304
     * @param string $warning
305
     */
306
    public function removeWarning($warning)
307
    {
308
        unset($this->warnings[array_search($warning, $this->warnings, true)]);
309
    }
310
311
    /**
312
     * @return bool
313
     */
314
    public function hasWaypointOrders()
315
    {
316
        return !empty($this->waypointOrders);
317
    }
318
319
    /**
320
     * @return int[]
321
     */
322
    public function getWaypointOrders()
323
    {
324
        return $this->waypointOrders;
325
    }
326
327
    /**
328
     * @param int[] $waypointOrders
329
     */
330
    public function setWaypointOrders(array $waypointOrders)
331
    {
332
        $this->waypointOrders = [];
333
        $this->addWaypointOrders($waypointOrders);
334
    }
335
336
    /**
337
     * @param int[] $waypointOrders
338
     */
339
    public function addWaypointOrders(array $waypointOrders)
340
    {
341
        $this->waypointOrders = [];
342
343
        foreach ($waypointOrders as $waypointOrder) {
344
            $this->addWaypointOrder($waypointOrder);
345
        }
346
    }
347
348
    /**
349
     * @param $waypointOrder
350
     *
351
     * @return bool
352
     */
353
    public function hasWaypointOrder($waypointOrder)
354
    {
355
        return in_array($waypointOrder, $this->waypointOrders, true);
356
    }
357
358
    /**
359
     * @param int $waypointOrder
360
     */
361
    public function addWaypointOrder($waypointOrder)
362
    {
363
        $this->waypointOrders[] = $waypointOrder;
364
    }
365
}
366