JtskObject   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 30
ccs 11
cts 11
cp 1
rs 10
wmc 7

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAltitude() 0 3 1
A setData() 0 6 4
A getLongitude() 0 3 1
A getLatitude() 0 3 1
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