Test Failed
Branch master (16bdc1)
by SignpostMarv
02:18
created

ListItem   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 35
dl 0
loc 83
ccs 22
cts 22
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

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