Passed
Push — master ( 81601f...461a97 )
by SignpostMarv
12:06
created

WarrantyPromise   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 32
dl 0
loc 77
ccs 26
cts 26
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A GetWarrantyScope() 0 12 1
A GetDurationOfWarranty() 0 12 1
A SetWarrantyScope() 0 8 1
A SetDurationOfWarranty() 0 7 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue;
8
9
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Service;
10
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue as Base;
11
use SignpostMarv\DaftObject\SchemaOrg\Product;
12
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
13
14
/**
15
* @property array<int, QuantitativeValue> $durationOfWarranty
16
* @property array<int, Product|Service> $warrantyScope
17
*/
18
class WarrantyPromise extends Base
19
{
20
    const SCHEMA_ORG_TYPE = 'WarrantyPromise';
21
22
    const PROPERTIES = [
23
        'durationOfWarranty',
24
        'warrantyScope',
25
    ];
26
27
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
28
        'durationOfWarranty' => [
29
            QuantitativeValue::class,
30
        ],
31
        'warrantyScope' => [
32
            Product::class,
33
            Service::class,
34
        ],
35
    ];
36
37
    /**
38
    * @return array<int, QuantitativeValue>
39
    */
40 4
    public function GetDurationOfWarranty() : array
41
    {
42
        /**
43
        * @var array<int, QuantitativeValue>
44
        */
45 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
46 4
            'durationOfWarranty',
47 4
            $this->RetrievePropertyValueFromData('durationOfWarranty'),
48 4
            static::class
49
        );
50
51 4
        return $out;
52
    }
53
54
    /**
55
    * @param array<int, QuantitativeValue> $value
56
    */
57 1
    public function SetDurationOfWarranty(array $value) : void
58
    {
59 1
        $this->NudgePropertyWithUniqueValuesOfThings(
60 1
            'durationOfWarranty',
61 1
            __METHOD__,
62 1
            $value,
63 1
            QuantitativeValue::class
64
        );
65 1
    }
66
67
    /**
68
    * @return array<int, Product|Service>
69
    */
70 4
    public function GetWarrantyScope() : array
71
    {
72
        /**
73
        * @var array<int, Product|Service>
74
        */
75 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
76 4
            'warrantyScope',
77 4
            $this->RetrievePropertyValueFromData('warrantyScope'),
78 4
            static::class
79
        );
80
81 4
        return $out;
82
    }
83
84
    /**
85
    * @param array<int, Product|Service> $value
86
    */
87 1
    public function SetWarrantyScope(array $value) : void
88
    {
89 1
        $this->NudgePropertyWithUniqueValuesOfThings(
90 1
            'warrantyScope',
91 1
            __METHOD__,
92 1
            $value,
93 1
            Product::class,
94 1
            Service::class
95
        );
96 1
    }
97
}
98