Latitude   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A guard() 0 6 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpValueObjects\Geography;
6
7
use PhpValueObjects\AbstractValueObject;
8
9
abstract class Latitude extends AbstractValueObject
10
{
11
    protected const MIN_LATITUDE = -90;
12
    protected const MAX_LATITUDE = 90;
13
14 9
    public function __construct(float $value)
15
    {
16 9
        parent::__construct($value);
17 3
    }
18
19 9
    protected function guard($value): void
20
    {
21 9
        if ($value < self::MIN_LATITUDE || $value > self::MAX_LATITUDE) {
22 6
            $this->throwException($value);
23
        }
24 3
    }
25
}
26