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.

DirectionTransitLine::setShortName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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 2
nc 1
nop 1
crap 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\Transit;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class DirectionTransitLine
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $name;
23
24
    /**
25
     * @var string|null
26
     */
27
    private $shortName;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $color;
33
34
    /**
35
     * @var string|null
36
     */
37
    private $url;
38
39
    /**
40
     * @var string|null
41
     */
42
    private $icon;
43
44
    /**
45
     * @var string|null
46
     */
47
    private $textColor;
48
49
    /**
50
     * @var DirectionTransitVehicle|null
51
     */
52
    private $vehicle;
53
54
    /**
55
     * @var DirectionTransitAgency[]
56
     */
57
    private $agencies = [];
58
59
    /**
60
     * @return bool
61
     */
62 8
    public function hasName()
63
    {
64 8
        return $this->name !== null;
65
    }
66
67
    /**
68
     * @return string|null
69
     */
70 24
    public function getName()
71
    {
72 24
        return $this->name;
73
    }
74
75
    /**
76
     * @param string|null $name
77
     */
78 4
    public function setName($name)
79
    {
80 4
        $this->name = $name;
81 4
    }
82
83
    /**
84
     * @return bool
85
     */
86 8
    public function hasShortName()
87
    {
88 8
        return $this->shortName !== null;
89
    }
90
91
    /**
92
     * @return string|null
93
     */
94 24
    public function getShortName()
95
    {
96 24
        return $this->shortName;
97
    }
98
99
    /**
100
     * @param string|null $shortName
101
     */
102 4
    public function setShortName($shortName)
103
    {
104 4
        $this->shortName = $shortName;
105 4
    }
106
107
    /**
108
     * @return bool
109
     */
110 8
    public function hasColor()
111
    {
112 8
        return $this->color !== null;
113
    }
114
115
    /**
116
     * @return string|null
117
     */
118 24
    public function getColor()
119
    {
120 24
        return $this->color;
121
    }
122
123
    /**
124
     * @param string|null $color
125
     */
126 4
    public function setColor($color)
127
    {
128 4
        $this->color = $color;
129 4
    }
130
131
    /**
132
     * @return bool
133
     */
134 8
    public function hasUrl()
135
    {
136 8
        return $this->url !== null;
137
    }
138
139
    /**
140
     * @return string|null
141
     */
142 24
    public function getUrl()
143
    {
144 24
        return $this->url;
145
    }
146
147
    /**
148
     * @param string|null $url
149
     */
150 4
    public function setUrl($url)
151
    {
152 4
        $this->url = $url;
153 4
    }
154
155
    /**
156
     * @return bool
157
     */
158 8
    public function hasIcon()
159
    {
160 8
        return $this->icon !== null;
161
    }
162
163
    /**
164
     * @return string|null
165
     */
166 24
    public function getIcon()
167
    {
168 24
        return $this->icon;
169
    }
170
171
    /**
172
     * @param string|null $icon
173
     */
174 4
    public function setIcon($icon)
175
    {
176 4
        $this->icon = $icon;
177 4
    }
178
179
    /**
180
     * @return bool
181
     */
182 8
    public function hasTextColor()
183
    {
184 8
        return $this->textColor !== null;
185
    }
186
187
    /**
188
     * @return string|null
189
     */
190 24
    public function getTextColor()
191
    {
192 24
        return $this->textColor;
193
    }
194
195
    /**
196
     * @param string|null $textColor
197
     */
198 4
    public function setTextColor($textColor)
199
    {
200 4
        $this->textColor = $textColor;
201 4
    }
202
203
    /**
204
     * @return bool
205
     */
206 8
    public function hasVehicle()
207
    {
208 8
        return $this->vehicle !== null;
209
    }
210
211
    /**
212
     * @return DirectionTransitVehicle|null
213
     */
214 24
    public function getVehicle()
215
    {
216 24
        return $this->vehicle;
217
    }
218
219
    /**
220
     * @param DirectionTransitVehicle|null $vehicle
221
     */
222 4
    public function setVehicle(DirectionTransitVehicle $vehicle = null)
223
    {
224 4
        $this->vehicle = $vehicle;
225 4
    }
226
227
    /**
228
     * @return bool
229
     */
230 20
    public function hasAgencies()
231
    {
232 20
        return !empty($this->agencies);
233
    }
234
235
    /**
236
     * @return DirectionTransitAgency[]
237
     */
238 36
    public function getAgencies()
239
    {
240 36
        return $this->agencies;
241
    }
242
243
    /**
244
     * @param DirectionTransitAgency[] $agencies
245
     */
246 8
    public function setAgencies(array $agencies)
247
    {
248 8
        $this->agencies = $agencies;
249 8
        $this->addAgencies($agencies);
250 8
    }
251
252
    /**
253
     * @param DirectionTransitAgency[] $agencies
254
     */
255 8
    public function addAgencies(array $agencies)
256
    {
257 8
        foreach ($agencies as $agency) {
258 8
            $this->addAgency($agency);
259 4
        }
260 8
    }
261
262
    /**
263
     * @param DirectionTransitAgency $agency
264
     *
265
     * @return bool
266
     */
267 16
    public function hasAgency(DirectionTransitAgency $agency)
268
    {
269 16
        return in_array($agency, $this->agencies, true);
270
    }
271
272
    /**
273
     * @param DirectionTransitAgency $agency
274
     */
275 16
    public function addAgency(DirectionTransitAgency $agency)
276
    {
277 16
        if (!$this->hasAgency($agency)) {
278 12
            $this->agencies[] = $agency;
279 6
        }
280 16
    }
281
282
    /**
283
     * @param DirectionTransitAgency $agency
284
     */
285 4
    public function removeAgency(DirectionTransitAgency $agency)
286
    {
287 4
        unset($this->agencies[array_search($agency, $this->agencies, true)]);
288 4
        $this->agencies = empty($this->agencies) ? [] : array_values($this->agencies);
289 4
    }
290
}
291