Passed
Pull Request — main (#8)
by Alex
03:11 queued 01:35
created

Coordinates   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 27
ccs 12
cts 12
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A longitude() 0 3 1
A latitude() 0 3 1
A fromValues() 0 5 1
1
<?php
2
3
namespace StraTDeS\VO\Single;
4
5
class Coordinates
6
{
7
    private CoordinatesLongitude $longitude;
8
    private CoordinatesLatitude $latitude;
9
10 3
    private function __construct(CoordinatesLongitude $longitude, CoordinatesLatitude $latitude)
11
    {
12 3
        $this->longitude = $longitude;
13 3
        $this->latitude = $latitude;
14 3
    }
15
16 3
    public static function fromValues(float $longitude, float $latitude): Coordinates
17
    {
18 3
        return new self(
19 3
            CoordinatesLongitude::fromValue($longitude),
20 3
            CoordinatesLatitude::fromValue($latitude)
21
        );
22
    }
23
24 1
    public function longitude(): CoordinatesLongitude
25
    {
26 1
        return $this->longitude;
27
    }
28
29 1
    public function latitude(): CoordinatesLatitude
30
    {
31 1
        return $this->latitude;
32
    }
33
}
34