DegreesObject::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 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