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 — services ( fe049d )
by Eric
03:30
created

DistanceMatrixResponse::addDestination()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 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\DistanceMatrix\Response;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class DistanceMatrixResponse
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $status;
23
24
    /**
25
     * @var string[]
26
     */
27
    private $origins = [];
28
29
    /**
30
     * @var string[]
31
     */
32
    private $destinations = [];
33
34
    /**
35
     * @var DistanceMatrixRow[]
36
     */
37
    private $rows = [];
38
39
    /**
40
     * @return bool
41
     */
42
    public function hasStatus()
43
    {
44
        return $this->status !== null;
45
    }
46
47
    /**
48
     * @return string|null
49
     */
50
    public function getStatus()
51
    {
52
        return $this->status;
53
    }
54
55
    /**
56
     * @param string|null $status
57
     */
58
    public function setStatus($status)
59
    {
60
        $this->status = $status;
61
    }
62
63
    /**
64
     * @return bool
65
     */
66
    public function hasOrigins()
67
    {
68
        return !empty($this->origins);
69
    }
70
71
    /**
72
     * @return string[]
73
     */
74
    public function getOrigins()
75
    {
76
        return $this->origins;
77
    }
78
79
    /**
80
     * @param string[] $origins
81
     */
82
    public function setOrigins(array $origins)
83
    {
84
        $this->origins = [];
85
        $this->addOrigins($origins);
86
    }
87
88
    /**
89
     * @param string[] $origins
90
     */
91
    public function addOrigins(array $origins)
92
    {
93
        foreach ($origins as $origin) {
94
            $this->addOrigin($origin);
95
        }
96
    }
97
98
    /**
99
     * @param string $origin
100
     *
101
     * @return bool
102
     */
103
    public function hasOrigin($origin)
104
    {
105
        return in_array($origin, $this->origins, true);
106
    }
107
108
    /**
109
     * @param string $origin
110
     */
111
    public function addOrigin($origin)
112
    {
113
        if (!$this->hasOrigin($origin)) {
114
            $this->origins[] = $origin;
115
        }
116
    }
117
118
    /**
119
     * @param string $origin
120
     */
121
    public function removeOrigin($origin)
122
    {
123
        unset($this->origins[array_search($origin, $this->origins, true)]);
124
        $this->origins = array_values($this->origins);
125
    }
126
127
    /**
128
     * @return bool
129
     */
130
    public function hasDestinations()
131
    {
132
        return !empty($this->destinations);
133
    }
134
135
    /**
136
     * @return string[]
137
     */
138
    public function getDestinations()
139
    {
140
        return $this->destinations;
141
    }
142
143
    /**
144
     * @param string[] $destinations
145
     */
146
    public function setDestinations(array $destinations)
147
    {
148
        $this->destinations = [];
149
        $this->addDestinations($destinations);
150
    }
151
152
    /**
153
     * @param string[] $destinations
154
     */
155
    public function addDestinations(array $destinations)
156
    {
157
        foreach ($destinations as $destination) {
158
            $this->addDestination($destination);
159
        }
160
    }
161
162
    /**
163
     * @param string $destination
164
     *
165
     * @return bool
166
     */
167
    public function hasDestination($destination)
168
    {
169
        return in_array($destination, $this->destinations, true);
170
    }
171
172
    /**
173
     * @param string $destination
174
     */
175
    public function addDestination($destination)
176
    {
177
        if (!$this->hasDestination($destination)) {
178
            $this->destinations[] = $destination;
179
        }
180
    }
181
182
    /**
183
     * @param string $destination
184
     */
185
    public function removeDestination($destination)
186
    {
187
        unset($this->destinations[array_search($destination, $this->destinations, true)]);
188
        $this->destinations = array_values($this->destinations);
189
    }
190
191
    /**
192
     * @return bool
193
     */
194
    public function hasRows()
195
    {
196
        return !empty($this->rows);
197
    }
198
199
    /**
200
     * @return DistanceMatrixRow[]
201
     */
202
    public function getRows()
203
    {
204
        return $this->rows;
205
    }
206
207
    /**
208
     * @param DistanceMatrixRow[] $rows
209
     */
210
    public function setRows(array $rows)
211
    {
212
        $this->rows = [];
213
        $this->addRows($rows);
214
    }
215
216
    /**
217
     * @param DistanceMatrixRow[] $rows
218
     */
219
    public function addRows(array $rows)
220
    {
221
        foreach ($rows as $row) {
222
            $this->addRow($row);
223
        }
224
    }
225
226
    /**
227
     * @param DistanceMatrixRow $row
228
     *
229
     * @return bool
230
     */
231
    public function hasRow(DistanceMatrixRow $row)
232
    {
233
        return in_array($row, $this->rows, true);
234
    }
235
236
    /**
237
     * @param DistanceMatrixRow $row
238
     */
239
    public function addRow(DistanceMatrixRow $row)
240
    {
241
        if (!$this->hasRow($row)) {
242
            $this->rows[] = $row;
243
        }
244
    }
245
246
    /**
247
     * @param DistanceMatrixRow $row
248
     */
249
    public function removeRow(DistanceMatrixRow $row)
250
    {
251
        unset($this->rows[array_search($row, $this->rows, true)]);
252
        $this->rows = array_values($this->rows);
253
    }
254
}
255