Passed
Branch fuzzy-generators (49fcec)
by SignpostMarv
08:30
created

GeoCoordinates   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Test Coverage

Coverage 52.17%

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 73
ccs 12
cts 23
cp 0.5217
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A SetLongitude() 0 6 1
A SetLatitude() 0 6 1
A GetLatitude() 0 12 1
A GetLongitude() 0 12 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg;
8
9
class GeoCoordinates extends Thing
10
{
11
    use DaftObjectTraits\HasAddress;
12
    use DaftObjectTraits\HasAddressCountry;
13
    use DaftObjectTraits\HasElevation;
14
    use DaftObjectTraits\HasPostalCode;
15
16
    const SCHEMA_ORG_TYPE = 'GeoCoordinates';
17
18
    const PROPERTIES = [
19
        'address',
20
        'addressCountry',
21
        'elevation',
22
        'latitude',
23
        'longitude',
24
        'postalCode',
25
    ];
26
27
    /**
28
    * @return array<int, string|float|int>
29
    */
30 1
    public function GetLatitude() : array
31
    {
32
        /**
33
        * @var array<int, string|float|int>
34
        */
35 1
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
36 1
            'latitude',
37 1
            $this->RetrievePropertyValueFromData('latitude'),
38 1
            static::class
39
        );
40
41 1
        return $out;
42
    }
43
44
    /**
45
    * @param array<int, string|float|int> $value
46
    */
47
    public function SetLatitude(array $value) : void
48
    {
49
        $this->NudgePropertyWithUniqueTrimmedStringsNumericsMightNotBeStringsOrNumerics(
50
            'latitude',
51
            __METHOD__,
52
            $value
53
        );
54
    }
55
56
    /**
57
    * @return array<int, string|float|int>
58
    */
59 1
    public function GetLongitude() : array
60
    {
61
        /**
62
        * @var array<int, string|float|int>
63
        */
64 1
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
65 1
            'longitude',
66 1
            $this->RetrievePropertyValueFromData('longitude'),
67 1
            static::class
68
        );
69
70 1
        return $out;
71
    }
72
73
    /**
74
    * @param array<int, string|float|int> $value
75
    */
76
    public function SetLongitude(array $value) : void
77
    {
78
        $this->NudgePropertyWithUniqueTrimmedStringsNumericsMightNotBeStringsOrNumerics(
79
            'longitude',
80
            __METHOD__,
81
            $value
82
        );
83
    }
84
}
85