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
Pull Request — master (#177)
by Eric
05:49 queued 03:32
created

PlaceSearchResponse   A

Complexity

Total Complexity 27

Size/Duplication

Total Lines 227
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 0

Importance

Changes 0
Metric Value
wmc 27
lcom 5
cbo 0
dl 0
loc 227
rs 10
c 0
b 0
f 0

23 Methods

Rating   Name   Duplication   Size   Complexity  
A hasStatus() 0 4 1
A getStatus() 0 4 1
A setStatus() 0 4 1
A hasRequest() 0 4 1
A getRequest() 0 4 1
A setRequest() 0 4 1
A hasResults() 0 4 1
A getResults() 0 4 1
A setResults() 0 5 1
A addResults() 0 6 2
A hasResult() 0 4 1
A addResult() 0 6 2
A removeResult() 0 5 1
A hasHtmlAttributions() 0 4 1
A getHtmlAttributions() 0 4 1
A setHtmlAttributions() 0 5 1
A addHtmlAttributions() 0 6 2
A hasHtmlAttribution() 0 4 1
A addHtmlAttribution() 0 6 2
A removeHtmlAttribution() 0 5 1
A hasNextPageToken() 0 4 1
A getNextPageToken() 0 4 1
A setNextPageToken() 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\Place\Search\Response;
13
14
use Ivory\GoogleMap\Service\Place\Base\Place;
15
use Ivory\GoogleMap\Service\Place\Search\Request\PlaceSearchRequestInterface;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class PlaceSearchResponse
21
{
22
    /**
23
     * @var string|null
24
     */
25
    private $status;
26
27
    /**
28
     * @var PlaceSearchRequestInterface|null
29
     */
30
    private $request;
31
32
    /**
33
     * @var Place[]
34
     */
35
    private $results = [];
36
37
    /**
38
     * @var string[]
39
     */
40
    private $htmlAttributions = [];
41
42
    /**
43
     * @var string|null
44
     */
45
    private $nextPageToken;
46
47
    /**
48
     * @return bool
49
     */
50
    public function hasStatus()
51
    {
52
        return $this->status !== null;
53
    }
54
55
    /**
56
     * @return string|null
57
     */
58
    public function getStatus()
59
    {
60
        return $this->status;
61
    }
62
63
    /**
64
     * @param string|null $status
65
     */
66
    public function setStatus($status)
67
    {
68
        $this->status = $status;
69
    }
70
71
    /**
72
     * @return bool
73
     */
74
    public function hasRequest()
75
    {
76
        return $this->request !== null;
77
    }
78
79
    /**
80
     * @return PlaceSearchRequestInterface|null
81
     */
82
    public function getRequest()
83
    {
84
        return $this->request;
85
    }
86
87
    /**
88
     * @param PlaceSearchRequestInterface|null $request
89
     */
90
    public function setRequest(PlaceSearchRequestInterface $request = null)
91
    {
92
        $this->request = $request;
93
    }
94
95
    /**
96
     * @return bool
97
     */
98
    public function hasResults()
99
    {
100
        return !empty($this->results);
101
    }
102
103
    /**
104
     * @return Place[]
105
     */
106
    public function getResults()
107
    {
108
        return $this->results;
109
    }
110
111
    /**
112
     * @param Place[] $results
113
     */
114
    public function setResults(array $results)
115
    {
116
        $this->results = [];
117
        $this->addResults($results);
118
    }
119
120
    /**
121
     * @param Place[] $results
122
     */
123
    public function addResults(array $results)
124
    {
125
        foreach ($results as $result) {
126
            $this->addResult($result);
127
        }
128
    }
129
130
    /**
131
     * @param Place $result
132
     *
133
     * @return bool
134
     */
135
    public function hasResult(Place $result)
136
    {
137
        return in_array($result, $this->results, true);
138
    }
139
140
    /**
141
     * @param Place $result
142
     */
143
    public function addResult(Place $result)
144
    {
145
        if (!$this->hasResult($result)) {
146
            $this->results[] = $result;
147
        }
148
    }
149
150
    /**
151
     * @param Place $result
152
     */
153
    public function removeResult(Place $result)
154
    {
155
        unset($this->results[array_search($result, $this->results, true)]);
156
        $this->results = array_values($this->results);
157
    }
158
159
    /**
160
     * @return bool
161
     */
162
    public function hasHtmlAttributions()
163
    {
164
        return !empty($this->htmlAttributions);
165
    }
166
167
    /**
168
     * @return string[]
169
     */
170
    public function getHtmlAttributions()
171
    {
172
        return $this->htmlAttributions;
173
    }
174
175
    /**
176
     * @param string[] $htmlAttributions
177
     */
178
    public function setHtmlAttributions(array $htmlAttributions)
179
    {
180
        $this->htmlAttributions = [];
181
        $this->addHtmlAttributions($htmlAttributions);
182
    }
183
184
    /**
185
     * @param string[] $htmlAttributions
186
     */
187
    public function addHtmlAttributions(array $htmlAttributions)
188
    {
189
        foreach ($htmlAttributions as $htmlAttribution) {
190
            $this->addHtmlAttribution($htmlAttribution);
191
        }
192
    }
193
194
    /**
195
     * @param string $htmlAttribution
196
     *
197
     * @return bool
198
     */
199
    public function hasHtmlAttribution($htmlAttribution)
200
    {
201
        return in_array($htmlAttribution, $this->htmlAttributions, true);
202
    }
203
204
    /**
205
     * @param string $htmlAttribution
206
     */
207
    public function addHtmlAttribution($htmlAttribution)
208
    {
209
        if (!$this->hasHtmlAttribution($htmlAttribution)) {
210
            $this->htmlAttributions[] = $htmlAttribution;
211
        }
212
    }
213
214
    /**
215
     * @param string $htmlAttribution
216
     */
217
    public function removeHtmlAttribution($htmlAttribution)
218
    {
219
        unset($this->htmlAttributions[array_search($htmlAttribution, $this->htmlAttributions, true)]);
220
        $this->htmlAttributions = array_values($this->htmlAttributions);
221
    }
222
223
    /**
224
     * @return bool
225
     */
226
    public function hasNextPageToken()
227
    {
228
        return $this->nextPageToken !== null;
229
    }
230
231
    /**
232
     * @return string|null
233
     */
234
    public function getNextPageToken()
235
    {
236
        return $this->nextPageToken;
237
    }
238
239
    /**
240
     * @param string|null $nextPageToken
241
     */
242
    public function setNextPageToken($nextPageToken)
243
    {
244
        $this->nextPageToken = $nextPageToken;
245
    }
246
}
247