JtskObject::setData()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 4
c 1
b 0
f 0
nc 8
nop 3
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 4
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