Passed
Push — master ( 79069a...205e6e )
by SignpostMarv
11:50
created

ItemList   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 46
dl 0
loc 112
ccs 38
cts 38
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A GetItemListElement() 0 12 1
A GetItemListOrder() 0 12 1
A GetNumberOfItems() 0 12 1
A SetItemListElement() 0 8 1
A SetNumberOfItems() 0 6 1
A SetItemListOrder() 0 7 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg;
8
9
/**
10
* @property array<int, string|Intangible\ListItem|Thing> $itemListElement
11
* @property array<int, string|Intangible\Enumeration\ItemListOrderType> $itemListOrder
12
* @property array<int, int> $numberOfItems
13
*/
14
class ItemList extends Thing
15
{
16
    const SCHEMA_ORG_TYPE = 'ItemList';
17
18
    const PROPERTIES = [
19
        'itemListElement',
20
        'itemListOrder',
21
        'numberOfItems',
22
    ];
23
24
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
25
        'itemListElement' => [
26
            'string',
27
            Intangible\ListItem::class,
28
            Thing::class,
29
        ],
30
        'itemListOrder' => [
31
            'string',
32
            Intangible\Enumeration\ItemListOrderType::class,
33
        ],
34
        'numberOfItems' => [
35
            'integer',
36
        ],
37
    ];
38
39
    /**
40
    * @return array<int, string|Intangible\ListItem|Thing>
41
    */
42 3
    public function GetItemListElement() : array
43
    {
44
        /**
45
        * @var array<int, string|Intangible\ListItem|Thing>
46
        */
47 3
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
48 3
            'itemListElement',
49 3
            $this->RetrievePropertyValueFromData('itemListElement'),
50 3
            static::class
51
        );
52
53 3
        return $out;
54
    }
55
56
    /**
57
    * @param array<int, string|Intangible\ListItem|Thing> $value
58
    */
59 1
    public function SetItemListElement(array $value) : void
60
    {
61 1
        $this->NudgePropertyWithUniqueTrimmedStringsOrThings(
62 1
            'itemListElement',
63 1
            __METHOD__,
64 1
            $value,
65 1
            Intangible\ListItem::class,
66 1
            Thing::class
67
        );
68 1
    }
69
70
    /**
71
    * @return array<int, string|Intangible\Enumeration\ItemListOrderType>
72
    */
73 3
    public function GetItemListOrder() : array
74
    {
75
        /**
76
        * @var array<int, string|Intangible\Enumeration\ItemListOrderType>
77
        */
78 3
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
79 3
            'itemListOrder',
80 3
            $this->RetrievePropertyValueFromData('itemListOrder'),
81 3
            static::class
82
        );
83
84 3
        return $out;
85
    }
86
87
    /**
88
    * @param array<int, string|Intangible\Enumeration\ItemListOrderType> $value
89
    */
90 1
    public function SetItemListOrder(array $value) : void
91
    {
92 1
        $this->NudgePropertyWithUniqueTrimmedStringsOrThings(
93 1
            'itemListOrder',
94 1
            __METHOD__,
95 1
            $value,
96 1
            Intangible\Enumeration\ItemListOrderType::class
97
        );
98 1
    }
99
100
    /**
101
    * @return array<int, int>
102
    */
103 3
    public function GetNumberOfItems() : array
104
    {
105
        /**
106
        * @var array<int, int>
107
        */
108 3
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
109 3
            'numberOfItems',
110 3
            $this->RetrievePropertyValueFromData('numberOfItems'),
111 3
            static::class
112
        );
113
114 3
        return $out;
115
    }
116
117
    /**
118
    * @param array<int, int> $value
119
    */
120 1
    public function SetNumberOfItems(array $value) : void
121
    {
122 1
        $this->NudgePropertyWithUniqueIntegers(
123 1
            'numberOfItems',
124 1
            __METHOD__,
125 1
            $value
126
        );
127 1
    }
128
}
129