HasLocation::GetLocation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 12
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
8
9
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\ContactPoint\PostalAddress;
10
use SignpostMarv\DaftObject\SchemaOrg\Place;
11
use SignpostMarv\DaftObject\SchemaOrg\Thing;
12
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
13
14
trait HasLocation
15
{
16
    use DaftObjectTrait;
17
18
    /**
19
    * @return array<int, string|Place|PostalAddress>
20
    */
21 182
    public function GetLocation() : array
22
    {
23
        /**
24
        * @var array<int, string|Place|PostalAddress>
25
        */
26 182
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
27 182
            'location',
28 182
            $this->RetrievePropertyValueFromData('location'),
29 182
            static::class
30
        );
31
32 182
        return $out;
33
    }
34
35
    /**
36
    * @param array<int, string|Place|PostalAddress> $value
37
    */
38 5
    public function SetLocation(array $value) : void
39
    {
40 5
        $this->NudgePropertyValue(
41 5
            'location',
42 5
            $value,
43 5
            Thing::BOOL_DEFAULT_AUTOTRIMSTRINGS
44
        );
45 5
    }
46
}
47