JtskObject::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\IFormatted;
7
8
9
/**
10
 * Class JtskObject
11
 * @package kalanis\kw_coordinates\Support
12
 * Transport values into other geographical system
13
 */
14
class JtskObject implements IFormatted
15
{
16
    /** @var float */
17
    protected float $x = 0.0;
18
    /** @var float */
19
    protected float $y = 0.0;
20
    /** @var float */
21
    protected float $z = 0.0;
22
23 4
    public function setData($x = '0', $y = '0', $z = '0'): IFormatted
24
    {
25 4
        $this->x = is_null($x) ? $this->x : floatval($x);
26 4
        $this->y = is_null($y) ? $this->y : floatval($y);
27 4
        $this->z = is_null($z) ? $this->z : floatval($z);
28 4
        return $this;
29
    }
30
31 4
    public function getLongitude(): float
32
    {
33 4
        return $this->x;
34
    }
35
36 4
    public function getLatitude(): float
37
    {
38 4
        return $this->y;
39
    }
40
41 1
    public function getAltitude(): float
42
    {
43 1
        return $this->z;
44
    }
45
}
46