Weight   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A GetWeight() 0 12 1
A SetWeight() 0 3 1
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\QuantitativeValue;
10
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
11
12
trait Weight
13
{
14
    use DaftObjectTrait;
15
16
    /**
17
    * @return array<int, QuantitativeValue>
18
    */
19 64
    public function GetWeight() : array
20
    {
21
        /**
22
        * @var array<int, QuantitativeValue>
23
        */
24 64
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
25 64
            'weight',
26 64
            $this->RetrievePropertyValueFromData('weight'),
27 64
            static::class
28
        );
29
30 64
        return $out;
31
    }
32
33
    /**
34
    * @param array<int, QuantitativeValue> $value
35
    */
36 3
    public function SetWeight(array $value) : void
37
    {
38 3
        $this->NudgePropertyValue('weight', $value);
39 3
    }
40
}
41