Passed
Push — master ( 6d0f47...81601f )
by SignpostMarv
12:06
created

ProductModel::SetPredecessorOf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
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 1
dl 0
loc 7
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\Product;
8
9
use SignpostMarv\DaftObject\SchemaOrg\Product as Base;
10
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
11
12
/**
13
* @property array<int, ProductModel> $isVariantOf
14
* @property array<int, ProductModel> $predecessorOf
15
* @property array<int, ProductModel> $successorOf
16
*/
17
class ProductModel extends Base
18
{
19
    const SCHEMA_ORG_TYPE = 'ProductModel';
20
21
    const PROPERTIES = [
22
        'isVariantOf',
23
        'predecessorOf',
24
        'successorOf',
25
    ];
26
27
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
28
        'isVariantOf' => [
29
            ProductModel::class,
30
        ],
31
        'predecessorOf' => [
32
            ProductModel::class,
33
        ],
34
        'successorOf' => [
35
            ProductModel::class,
36
        ],
37
    ];
38
39
    /**
40
    * @return array<int, ProductModel>
41
    */
42 5
    public function GetIsVariantOf() : array
43
    {
44
        /**
45
        * @var array<int, ProductModel>
46
        */
47 5
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
48 5
            'isVariantOf',
49 5
            $this->RetrievePropertyValueFromData('isVariantOf'),
50 5
            static::class
51
        );
52
53 5
        return $out;
54
    }
55
56
    /**
57
    * @param array<int, ProductModel> $value
58
    */
59 1
    public function SetIsVariantOf(array $value) : void
60
    {
61 1
        $this->NudgePropertyWithUniqueValuesOfThings(
62 1
            'isVariantOf',
63 1
            __METHOD__,
64 1
            $value,
65 1
            ProductModel::class
66
        );
67 1
    }
68
69
    /**
70
    * @return array<int, ProductModel>
71
    */
72 5
    public function GetPredecessorOf() : array
73
    {
74
        /**
75
        * @var array<int, ProductModel>
76
        */
77 5
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
78 5
            'predecessorOf',
79 5
            $this->RetrievePropertyValueFromData('predecessorOf'),
80 5
            static::class
81
        );
82
83 5
        return $out;
84
    }
85
86
    /**
87
    * @param array<int, ProductModel> $value
88
    */
89 1
    public function SetPredecessorOf(array $value) : void
90
    {
91 1
        $this->NudgePropertyWithUniqueValuesOfThings(
92 1
            'predecessorOf',
93 1
            __METHOD__,
94 1
            $value,
95 1
            ProductModel::class
96
        );
97 1
    }
98
99
    /**
100
    * @return array<int, ProductModel>
101
    */
102 5
    public function GetSuccessorOf() : array
103
    {
104
        /**
105
        * @var array<int, ProductModel>
106
        */
107 5
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
108 5
            'successorOf',
109 5
            $this->RetrievePropertyValueFromData('successorOf'),
110 5
            static::class
111
        );
112
113 5
        return $out;
114
    }
115
116
    /**
117
    * @param array<int, ProductModel> $value
118
    */
119 1
    public function SetSuccessorOf(array $value) : void
120
    {
121 1
        $this->NudgePropertyWithUniqueValuesOfThings(
122 1
            'successorOf',
123 1
            __METHOD__,
124 1
            $value,
125 1
            ProductModel::class
126
        );
127 1
    }
128
}
129