Latitude   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
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 24
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 Latitude extends Real
10
{
11
12
    /**
13
     * Returns a new Latitude object
14
     *
15
     * @param $value
16
     * @throws InvalidNativeArgumentException
17
     */
18 12
    public function __construct($value)
19
    {
20 12
        $value = \filter_var($value, FILTER_VALIDATE_FLOAT);
21
22 12
        if (false === $value) {
23 1
            throw new InvalidNativeArgumentException($value, array('float'));
24
        }
25
26
        // normalization process through Coordinate object
27 11
        $coordinate = new BaseCoordinate(array($value, 0));
28 11
        $latitude   = $coordinate->getLatitude();
29
30 11
        $this->value = $latitude;
31 11
    }
32
}
33