Longitude   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 2
1
<?php
2
3
namespace ValueObjects\Geography;
4
5
use League\Geotools\Coordinate\Coordinate as BaseCoordinate;
6
use ValueObjects\Exception\InvalidNativeArgumentException;
7
use ValueObjects\Number\Real;
8
9
class Longitude extends Real
10
{
11
    /**
12
     * Returns a new Longitude object
13
     *
14
     * @param $value
15
     * @throws InvalidNativeArgumentException
16
     */
17 12
    public function __construct($value)
18
    {
19 12
        $filteredValue = \filter_var($value, FILTER_VALIDATE_FLOAT);
20
21 12
        if (false === $filteredValue) {
22 1
            throw new InvalidNativeArgumentException($value, array('float'));
23
        }
24
25
        // normalization process through Coordinate object
26 11
        $coordinate = new BaseCoordinate(array(0, $filteredValue));
27 11
        $longitude  = $coordinate->getLongitude();
28
29 11
        $this->value = $longitude;
30 11
    }
31
}
32