Issues (19)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Region/RegionEntity.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace GeoBase\Regions\Region;
4
5
use GeoBase\Countries\Coordinate\CoordinateCollectionInterface;
6
use GeoBase\Countries\Coordinate\CoordinateLogic;
7
use GeoBase\Countries\Country\CountryEntity;
8
use GeoBase\Countries\Geo;
9
use GeoBase\Regions\Region\RegionName\RegionNameCollection;
10
use GeoBase\Regions\Region\Type\TypeInterface;
11
use JsonSerializable;
12
use League\Geotools\BoundingBox\BoundingBox;
13
use League\Geotools\Coordinate\Coordinate;
14
use League\Geotools\Polygon\Polygon;
15
16
class RegionEntity extends CoordinateLogic implements JsonSerializable, CoordinateCollectionInterface
17
{
18
    /**
19
     * @var Coordinate
20
     */
21
    protected $coordinate;
22
23
    /**
24
     * @var BoundingBox
25
     */
26
    protected $boundingBox;
27
28
    /**
29
     * @var RegionNameCollection
30
     */
31
    protected $names;
32
33
    /**
34
     * @var CountryEntity
35
     */
36
    protected $country;
37
38
    /**
39
     * @var Polygon
40
     */
41
    protected $polygon;
42
43
    /**
44
     * @var string
45
     */
46
    protected $unmappedCountry;
47
48
    /**
49
     * @var string
50
     */
51
    protected $code;
52
53
    /**
54
     * @var string
55
     */
56
    protected $longCode;
57
58
    /**
59
     * @var TypeInterface|string
60
     */
61
    protected $type;
62
63
    /**
64
     * @var string
65
     */
66
    protected $timezone;
67
68
    /**
69
     * @var string
70
     */
71
    protected $latitude;
72
73
    /**
74
     * @var string
75
     */
76
    protected $longitude;
77
78
    /**
79
     * @var string
80
     */
81
    protected $north;
82
83
    /**
84
     * @var string
85
     */
86
    protected $east;
87
88
    /**
89
     * @var string
90
     */
91
    protected $south;
92
93
    /**
94
     * @var string
95
     */
96
    protected $west;
97
98 4 View Code Duplication
    public function __construct()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
99
    {
100 4
        $this->boundingBox = new BoundingBox();
101 4
        $this->polygon = new Polygon();
102 4
        $this->coordinate = new Coordinate([
103 4
            $this->latitude,
104 4
            $this->longitude,
105
        ]);
106 4
        $this->setNames(new RegionNameCollection());
107 4
    }
108
109
    /**
110
     * @return array
111
     */
112
    public function jsonSerialize()
113
    {
114
        return [
115
            'names'     => $this->getNames(),
116
            'code'      => $this->getCode(),
117
            'long_code' => $this->getLongCode(),
118
            'type'      => $this->getType(),
119
            'country'   => $this->getCountry(),
120
            'timezone'  => $this->getTimezone(),
121
            'latitude'  => $this->getLatitude(),
122
            'longitude' => $this->getLongitude(),
123
            'north'     => $this->getNorth(),
124
            'east'      => $this->getEast(),
125
            'south'     => $this->getSouth(),
126
            'west'      => $this->getWest(),
127
        ];
128
    }
129
130
    /**
131
     * @return Polygon
132
     */
133
    public function getPolygon()
134
    {
135
        return $this->polygon;
136
    }
137
138
    /**
139
     * @param Polygon $polygon
140
     *
141
     * @return $this
142
     */
143
    public function setPolygon(Polygon $polygon)
144
    {
145
        $this->polygon = $polygon;
146
147
        return $this;
148
    }
149
150
    /**
151
     * @return BoundingBox
152
     */
153 4
    public function getBoundingBox()
154
    {
155 4
        return $this->boundingBox;
156
    }
157
158
    /**
159
     * @param BoundingBox $boundingBox
160
     *
161
     * @return $this
162
     */
163
    public function setBoundingBox(BoundingBox $boundingBox)
164
    {
165
        $this->boundingBox = $boundingBox;
166
167
        return $this;
168
    }
169
170
    /**
171
     * @return string
172
     */
173 3
    public function getCode()
174
    {
175 3
        return $this->code;
176
    }
177
178
    /**
179
     * @param string $code
180
     *
181
     * @return $this
182
     */
183 4
    public function setCode($code)
184
    {
185 4
        $this->code = $code;
186
187 4
        return $this;
188
    }
189
190
    /**
191
     * @return string
192
     */
193
    public function getLongCode()
194
    {
195
        return $this->longCode;
196
    }
197
198
    /**
199
     * @param string $longCode
200
     *
201
     * @return $this
202
     */
203 4
    public function setLongCode($longCode)
204
    {
205 4
        $this->longCode = $longCode;
206
207 4
        return $this;
208
    }
209
210
    /**
211
     * @return Coordinate
212
     */
213
    public function getCoordinate()
214
    {
215
        return $this->coordinate;
216
    }
217
218
    /**
219
     * @param Coordinate $coordinate
220
     *
221
     * @return $this
222
     */
223
    public function setCoordinate(Coordinate $coordinate)
224
    {
225
        $this->coordinate = $coordinate;
226
227
        return $this;
228
    }
229
230
    /**
231
     * @return string
232
     */
233
    public function getLatitude()
234
    {
235
        return $this->latitude;
236
    }
237
238
    /**
239
     * @param string $latitude
240
     *
241
     * @return $this
242
     */
243 4
    public function setLatitude($latitude)
244
    {
245 4
        $this->latitude = $latitude;
246 4
        $this->coordinate->setLatitude($this->latitude);
247
248 4
        return $this;
249
    }
250
251
    /**
252
     * @return string
253
     */
254
    public function getLongitude()
255
    {
256
        return $this->longitude;
257
    }
258
259
    /**
260
     * @param string $longitude
261
     *
262
     * @return $this
263
     */
264 4
    public function setLongitude($longitude)
265
    {
266 4
        $this->longitude = $longitude;
267 4
        $this->coordinate->setLongitude($this->longitude);
268
269 4
        return $this;
270
    }
271
272
    /**
273
     * @return RegionNameCollection
274
     */
275 4
    public function getNames()
276
    {
277 4
        return $this->names;
278
    }
279
280
    /**
281
     * @param RegionNameCollection $names
282
     *
283
     * @return $this
284
     */
285 4
    public function setNames(RegionNameCollection $names)
286
    {
287 4
        $this->names = $names;
288
289 4
        return $this;
290
    }
291
292
    /**
293
     * @return string
294
     */
295
    public function getTimezone()
296
    {
297
        return $this->timezone;
298
    }
299
300
    /**
301
     * @param string $timezone
302
     *
303
     * @return $this
304
     */
305 4
    public function setTimezone($timezone)
306
    {
307 4
        $this->timezone = $timezone;
308
309 4
        return $this;
310
    }
311
312
    /**
313
     * @return TypeInterface|string
314
     */
315
    public function getType()
316
    {
317
        return $this->type;
318
    }
319
320
    /**
321
     * @param TypeInterface|string $type
322
     *
323
     * @return $this
324
     */
325 4
    public function setType($type)
326
    {
327 4
        $this->type = $type;
328
329 4
        return $this;
330
    }
331
332
    /**
333
     * @return string
334
     */
335
    public function getNorth()
336
    {
337
        return $this->north;
338
    }
339
340
    /**
341
     * @param string $north
342
     *
343
     * @return $this
344
     */
345 4
    public function setNorth($north)
346
    {
347 4
        $this->getBoundingBox()->setNorth($north);
348 4
        $this->north = $north;
349
350 4
        return $this;
351
    }
352
353
    /**
354
     * @return string
355
     */
356
    public function getEast()
357
    {
358
        return $this->east;
359
    }
360
361
    /**
362
     * @param string $east
363
     *
364
     * @return $this
365
     */
366 4
    public function setEast($east)
367
    {
368 4
        $this->getBoundingBox()->setEast($east);
369 4
        $this->east = $east;
370
371 4
        return $this;
372
    }
373
374
    /**
375
     * @return string
376
     */
377
    public function getSouth()
378
    {
379
        return $this->south;
380
    }
381
382
    /**
383
     * @param string $south
384
     *
385
     * @return $this
386
     */
387 4
    public function setSouth($south)
388
    {
389 4
        $this->getBoundingBox()->setSouth($south);
390 4
        $this->south = $south;
391
392 4
        return $this;
393
    }
394
395
    /**
396
     * @return string
397
     */
398
    public function getWest()
399
    {
400
        return $this->west;
401
    }
402
403
    /**
404
     * @param string $west
405
     *
406
     * @return $this
407
     */
408 4
    public function setWest($west)
409
    {
410 4
        $this->getBoundingBox()->setWest($west);
411 4
        $this->west = $west;
412
413 4
        return $this;
414
    }
415
416
    /**
417
     * @return CountryEntity
418
     */
419
    public function getCountry()
420
    {
421
        if (null !== $this->unmappedCountry && null === $this->country) {
422
            $this->country = Geo::getCountryRepository()->findByShortCode($this->unmappedCountry);
423
        }
424
425
        return $this->country;
426
    }
427
428
    /**
429
     * @param CountryEntity|string $country
430
     *
431
     * @return $this
432
     */
433
    public function setCountry($country)
434
    {
435
        if (is_string($country)) {
436
            $this->unmappedCountry = $country;
437
        } else {
438
            $this->country = $country;
439
        }
440
441
        return $this;
442
    }
443
444
    /**
445
     * @return string
446
     */
447
    public function getUnmappedCountry()
448
    {
449
        return $this->unmappedCountry;
450
    }
451
452
    /**
453
     * @param string $unmappedCountry
454
     *
455
     * @return $this
456
     */
457 4
    public function setUnmappedCountry($unmappedCountry)
458
    {
459 4
        $this->unmappedCountry = $unmappedCountry;
460
461 4
        return $this;
462
    }
463
464
    /**
465
     * {@inheritdoc}
466
     */
467
    public function normalizeLatitude($latitude)
468
    {
469
        return $this->coordinate->normalizeLatitude($latitude);
470
    }
471
472
    /**
473
     * {@inheritdoc}
474
     */
475
    public function normalizeLongitude($longitude)
476
    {
477
        return $this->coordinate->normalizeLongitude($longitude);
478
    }
479
480
    /**
481
     * {@inheritdoc}
482
     */
483
    public function getEllipsoid()
484
    {
485
        return $this->coordinate->getEllipsoid();
486
    }
487
}
488