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/Country/CountryEntity.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\Countries\Country;
4
5
use GeoBase\Countries\Coordinate\CoordinateCollectionInterface;
6
use GeoBase\Countries\Coordinate\CoordinateLogic;
7
use GeoBase\Countries\Country\CountryName\CountryNameCollection;
8
use GeoBase\Regions\Region\RegionCollection;
9
use JsonSerializable;
10
use League\Geotools\BoundingBox\BoundingBox;
11
use League\Geotools\Coordinate\Coordinate;
12
use League\Geotools\Polygon\Polygon;
13
14
class CountryEntity extends CoordinateLogic implements JsonSerializable, CoordinateCollectionInterface
15
{
16
    /**
17
     * @var Coordinate
18
     */
19
    protected $coordinate;
20
21
    /**
22
     * @var BoundingBox
23
     */
24
    protected $boundingBox;
25
26
    /**
27
     * @var RegionCollection
28
     */
29
    protected $regions;
30
31
    /**
32
     * @var Polygon
33
     */
34
    protected $polygon;
35
36
    /**
37
     * @var CountryNameCollection
38
     */
39
    protected $names;
40
41
    /**
42
     * @var string
43
     */
44
    protected $shortCode;
45
46
    /**
47
     * @var string
48
     */
49
    protected $code;
50
51
    /**
52
     * @var string
53
     */
54
    protected $latitude;
55
56
    /**
57
     * @var string
58
     */
59
    protected $longitude;
60
61
    /**
62
     * @var string
63
     */
64
    protected $currency;
65
66
    /**
67
     * @var string
68
     */
69
    protected $continent;
70
71
    /**
72
     * @var string
73
     */
74
    protected $population;
75
76
    /**
77
     * @var string
78
     */
79
    protected $area;
80
81
    /**
82
     * @var string
83
     */
84
    protected $capital;
85
86
    /**
87
     * @var string
88
     */
89
    protected $timezone;
90
91
    /**
92
     * @var string
93
     */
94
    protected $north;
95
96
    /**
97
     * @var string
98
     */
99
    protected $east;
100
101
    /**
102
     * @var string
103
     */
104
    protected $south;
105
106
    /**
107
     * @var string
108
     */
109
    protected $west;
110
111 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...
112
    {
113 4
        $this->boundingBox = new BoundingBox();
114 4
        $this->regions = new RegionCollection();
115 4
        $this->polygon = new Polygon();
116 4
        $this->coordinate = new Coordinate([
117 4
            $this->latitude,
118 4
            $this->longitude,
119
        ]);
120 4
        $this->setNames(new CountryNameCollection());
121 4
    }
122
123
    /**
124
     * @return array
125
     */
126
    public function toArray()
127
    {
128
        return [
129
            'names'      => $this->getNames(),
130
            'short_code' => $this->getShortCode(),
131
            'code'       => $this->getCode(),
132
            'latitude'   => $this->getLatitude(),
133
            'longitude'  => $this->getLongitude(),
134
            'currency'   => $this->getCurrency(),
135
            'continent'  => $this->getContinent(),
136
            'population' => $this->getPopulation(),
137
            'area'       => $this->getArea(),
138
            'capital'    => $this->getCapital(),
139
            'timezone'   => $this->getTimezone(),
140
            'north'      => $this->getNorth(),
141
            'east'       => $this->getEast(),
142
            'south'      => $this->getSouth(),
143
            'west'       => $this->getWest(),
144
        ];
145
    }
146
147
    /**
148
     * @return array
149
     */
150
    public function jsonSerialize()
151
    {
152
        return $this->toArray();
153
    }
154
155
    /**
156
     * @return Coordinate
157
     */
158 4
    public function getCoordinate()
159
    {
160 4
        return $this->coordinate;
161
    }
162
163
    /**
164
     * @param Coordinate $coordinate
165
     *
166
     * @return $this
167
     */
168
    public function setCoordinate(Coordinate $coordinate)
169
    {
170
        $this->coordinate = $coordinate;
171
172
        return $this;
173
    }
174
175
    /**
176
     * @return BoundingBox
177
     */
178 4
    public function getBoundingBox()
179
    {
180 4
        return $this->boundingBox;
181
    }
182
183
    /**
184
     * @param BoundingBox $boundingBox
185
     *
186
     * @return $this
187
     */
188
    public function setBoundingBox(BoundingBox $boundingBox)
189
    {
190
        $this->boundingBox = $boundingBox;
191
192
        return $this;
193
    }
194
195
    /**
196
     * @return RegionCollection
197
     */
198
    public function getRegions()
199
    {
200
        return $this->regions;
201
    }
202
203
    /**
204
     * @param RegionCollection $regions
205
     *
206
     * @return $this
207
     */
208
    public function setRegions(RegionCollection $regions)
209
    {
210
        $this->regions = $regions;
211
212
        return $this;
213
    }
214
215
    /**
216
     * @return Polygon
217
     */
218
    public function getPolygon()
219
    {
220
        return $this->polygon;
221
    }
222
223
    /**
224
     * @param Polygon $polygon
225
     *
226
     * @return $this
227
     */
228
    public function setPolygon(Polygon $polygon)
229
    {
230
        $this->polygon = $polygon;
231
232
        return $this;
233
    }
234
235
    /**
236
     * @return CountryNameCollection
237
     */
238 4
    public function getNames()
239
    {
240 4
        return $this->names;
241
    }
242
243
    /**
244
     * @param CountryNameCollection $names
245
     *
246
     * @return $this
247
     */
248 4
    public function setNames(CountryNameCollection $names)
249
    {
250 4
        $this->names = $names;
251
252 4
        return $this;
253
    }
254
255
    /**
256
     * @return string
257
     */
258
    public function getShortCode()
259
    {
260
        return $this->shortCode;
261
    }
262
263
    /**
264
     * @param string $shortCode
265
     *
266
     * @return $this
267
     */
268 4
    public function setShortCode($shortCode)
269
    {
270 4
        $this->shortCode = $shortCode;
271
272 4
        return $this;
273
    }
274
275
    /**
276
     * @return string
277
     */
278 3
    public function getCode()
279
    {
280 3
        return $this->code;
281
    }
282
283
    /**
284
     * @param string $code
285
     *
286
     * @return $this
287
     */
288 4
    public function setCode($code)
289
    {
290 4
        $this->code = $code;
291
292 4
        return $this;
293
    }
294
295
    /**
296
     * @return string
297
     */
298
    public function getLatitude()
299
    {
300
        return $this->latitude;
301
    }
302
303
    /**
304
     * @param string $latitude
305
     *
306
     * @return $this
307
     */
308 4
    public function setLatitude($latitude)
309
    {
310 4
        $this->getCoordinate()->setLatitude($latitude);
311 4
        $this->latitude = $latitude;
312
313 4
        return $this;
314
    }
315
316
    /**
317
     * @return string
318
     */
319
    public function getLongitude()
320
    {
321
        return $this->longitude;
322
    }
323
324
    /**
325
     * @param string $longitude
326
     *
327
     * @return $this
328
     */
329 4
    public function setLongitude($longitude)
330
    {
331 4
        $this->getCoordinate()->setLongitude($longitude);
332 4
        $this->longitude = $longitude;
333
334 4
        return $this;
335
    }
336
337
    /**
338
     * @return string
339
     */
340
    public function getCurrency()
341
    {
342
        return $this->currency;
343
    }
344
345
    /**
346
     * @param string $currency
347
     *
348
     * @return $this
349
     */
350 4
    public function setCurrency($currency)
351
    {
352 4
        $this->currency = $currency;
353
354 4
        return $this;
355
    }
356
357
    /**
358
     * @return string
359
     */
360
    public function getContinent()
361
    {
362
        return $this->continent;
363
    }
364
365
    /**
366
     * @param string $continent
367
     *
368
     * @return $this
369
     */
370 4
    public function setContinent($continent)
371
    {
372 4
        $this->continent = $continent;
373
374 4
        return $this;
375
    }
376
377
    /**
378
     * @return string
379
     */
380
    public function getPopulation()
381
    {
382
        return $this->population;
383
    }
384
385
    /**
386
     * @param string $population
387
     *
388
     * @return $this
389
     */
390 4
    public function setPopulation($population)
391
    {
392 4
        $this->population = $population;
393
394 4
        return $this;
395
    }
396
397
    /**
398
     * @return string
399
     */
400
    public function getArea()
401
    {
402
        return $this->area;
403
    }
404
405
    /**
406
     * @param string $area
407
     *
408
     * @return $this
409
     */
410 4
    public function setArea($area)
411
    {
412 4
        $this->area = $area;
413
414 4
        return $this;
415
    }
416
417
    /**
418
     * @return string
419
     */
420
    public function getCapital()
421
    {
422
        return $this->capital;
423
    }
424
425
    /**
426
     * @param string $capital
427
     *
428
     * @return $this
429
     */
430 4
    public function setCapital($capital)
431
    {
432 4
        $this->capital = $capital;
433
434 4
        return $this;
435
    }
436
437
    /**
438
     * @return string
439
     */
440
    public function getTimezone()
441
    {
442
        return $this->timezone;
443
    }
444
445
    /**
446
     * @param string $timezone
447
     *
448
     * @return $this
449
     */
450 4
    public function setTimezone($timezone)
451
    {
452 4
        $this->timezone = $timezone;
453
454 4
        return $this;
455
    }
456
457
    /**
458
     * @return string
459
     */
460
    public function getNorth()
461
    {
462
        return $this->north;
463
    }
464
465
    /**
466
     * @param string $north
467
     *
468
     * @return $this
469
     */
470 4
    public function setNorth($north)
471
    {
472 4
        $this->getBoundingBox()->setNorth($north);
473 4
        $this->north = $north;
474
475 4
        return $this;
476
    }
477
478
    /**
479
     * @return string
480
     */
481
    public function getEast()
482
    {
483
        return $this->east;
484
    }
485
486
    /**
487
     * @param string $east
488
     *
489
     * @return $this
490
     */
491 4
    public function setEast($east)
492
    {
493 4
        $this->getBoundingBox()->setEast($east);
494 4
        $this->east = $east;
495
496 4
        return $this;
497
    }
498
499
    /**
500
     * @return string
501
     */
502
    public function getSouth()
503
    {
504
        return $this->south;
505
    }
506
507
    /**
508
     * @param string $south
509
     *
510
     * @return $this
511
     */
512 4
    public function setSouth($south)
513
    {
514 4
        $this->getBoundingBox()->setSouth($south);
515 4
        $this->south = $south;
516
517 4
        return $this;
518
    }
519
520
    /**
521
     * @return string
522
     */
523
    public function getWest()
524
    {
525
        return $this->west;
526
    }
527
528
    /**
529
     * @param string $west
530
     *
531
     * @return $this
532
     */
533 4
    public function setWest($west)
534
    {
535 4
        $this->getBoundingBox()->setWest($west);
536 4
        $this->west = $west;
537
538 4
        return $this;
539
    }
540
541
    /**
542
     * {@inheritdoc}
543
     */
544
    public function normalizeLatitude($latitude)
545
    {
546
        return $this->coordinate->normalizeLatitude($latitude);
547
    }
548
549
    /**
550
     * {@inheritdoc}
551
     */
552
    public function normalizeLongitude($longitude)
553
    {
554
        return $this->coordinate->normalizeLongitude($longitude);
555
    }
556
557
    /**
558
     * {@inheritdoc}
559
     */
560
    public function getEllipsoid()
561
    {
562
        return $this->coordinate->getEllipsoid();
563
    }
564
}
565