DegreesObject   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 getLatitude() 0 3 1
A getLongitude() 0 3 1
A setData() 0 6 4
A getAltitude() 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 DegreesObject
11
 * @package kalanis\kw_coordinates\Support
12
 * Transport values into other geographical system
13
 */
14
class DegreesObject implements IFormatted
15
{
16
    /** @var string X  +-180° */
17
    protected string $longitude = '0';
18
    /** @var string Y +-90° */
19
    protected string $latitude = '0';
20
    /** @var string Z +-10000m */
21
    protected string $altitude = '0';
22
23 17
    public function setData($longitude = '0', $latitude = '0', $altitude = '0'): IFormatted
24
    {
25 17
        $this->longitude = is_null($longitude) ? $this->longitude : strval($longitude);
26 17
        $this->latitude = is_null($latitude) ? $this->latitude : strval($latitude);
27 17
        $this->altitude = is_null($altitude) ? $this->altitude : strval($altitude);
28 17
        return $this;
29
    }
30
31 17
    public function getLongitude(): string
32
    {
33 17
        return $this->longitude;
34
    }
35
36 16
    public function getLatitude(): string
37
    {
38 16
        return $this->latitude;
39
    }
40
41 12
    public function getAltitude(): string
42
    {
43 12
        return $this->altitude;
44
    }
45
}
46