Position::getLongitude()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace kalanis\kw_coordinates\Support;
4
5
6
use kalanis\kw_coordinates\Interfaces\INumbers;
7
8
9
/**
10
 * Class Position
11
 * @package kalanis\kw_coordinates\Support
12
 * Transport values into other geographical system
13
 */
14
class Position implements INumbers
15
{
16
    /** @var float X  +-180° */
17
    protected float $longitude = 0.0;
18
    /** @var float Y +-90° */
19
    protected float $latitude = 0.0;
20
    /** @var float Z +-10000m */
21
    protected float $altitude = 0.0;
22
23 20
    public function setData(?float $longitude = 0.0, ?float $latitude = 0.0, ?float $altitude = 0.0): INumbers
24
    {
25 20
        $this->longitude = is_null($longitude) ? $this->longitude : $longitude;
26 20
        $this->latitude = is_null($latitude) ? $this->latitude : $latitude;
27 20
        $this->altitude = is_null($altitude) ? $this->altitude : $altitude;
28 20
        return $this;
29
    }
30
31 20
    public function getLongitude(): float
32
    {
33 20
        return $this->longitude;
34
    }
35
36 20
    public function getLatitude(): float
37
    {
38 20
        return $this->latitude;
39
    }
40
41 14
    public function getAltitude(): float
42
    {
43 14
        return $this->altitude;
44
    }
45
}
46