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

InteractionCounter::SetUserInteractionCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 5
cts 5
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\Intangible\StructuredValue;
8
9
use SignpostMarv\DaftObject\SchemaOrg\Action;
10
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork;
11
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\SoftwareApplication;
12
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\WebSite;
13
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue as Base;
14
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
15
16
/**
17
* @property array<int, SoftwareApplication|WebSite> $interactionService
18
* @property array<int, Action> $interactionType
19
* @property array<int, int> $userInteractionCount
20
*/
21
class InteractionCounter extends Base
22
{
23
    const SCHEMA_ORG_TYPE = 'InteractionCounter';
24
25
    const PROPERTIES = [
26
        'interactionService',
27
        'interactionType',
28
        'userInteractionCount',
29
    ];
30
31
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
32
        'interactionService' => [
33
            SoftwareApplication::class,
34
            WebSite::class,
35
        ],
36
        'interactionType' => [
37
            Action::class,
38
        ],
39
        'userInteractionCount' => [
40
            'integer',
41
        ],
42
    ];
43
44
    /**
45
    * @return array<int, SoftwareApplication|WebSite>
46
    */
47 64
    public function GetInteractionService() : array
48
    {
49
        /**
50
        * @var array<int, SoftwareApplication|WebSite>
51
        */
52 64
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
53 64
            'interactionService',
54 64
            $this->RetrievePropertyValueFromData('interactionService'),
55 64
            static::class
56
        );
57
58 64
        return $out;
59
    }
60
61
    /**
62
    * @param array<int, SoftwareApplication|WebSite> $value
63
    */
64 1
    public function SetInteractionService(array $value) : void
65
    {
66 1
        $this->NudgePropertyWithUniqueValuesOfThings(
67 1
            'interactionService',
68 1
            __METHOD__,
69 1
            $value,
70 1
            CreativeWork::class,
71 1
            WebSite::class
72
        );
73 1
    }
74
75
    /**
76
    * @return array<int, Action>
77
    */
78 64
    public function GetInteractionType() : array
79
    {
80
        /**
81
        * @var array<int, Action>
82
        */
83 64
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
84 64
            'interactionType',
85 64
            $this->RetrievePropertyValueFromData('interactionType'),
86 64
            static::class
87
        );
88
89 64
        return $out;
90
    }
91
92
    /**
93
    * @param array<int, Action> $value
94
    */
95 1
    public function SetInteractionType(array $value) : void
96
    {
97 1
        $this->NudgePropertyWithUniqueValuesOfThings(
98 1
            'interactionType',
99 1
            __METHOD__,
100 1
            $value,
101 1
            Action::class
102
        );
103 1
    }
104
105
    /**
106
    * @return array<int, int>
107
    */
108 64
    public function GetUserInteractionCount() : array
109
    {
110
        /**
111
        * @var array<int, int>
112
        */
113 64
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
114 64
            'userInteractionCount',
115 64
            $this->RetrievePropertyValueFromData('userInteractionCount'),
116 64
            static::class
117
        );
118
119 64
        return $out;
120
    }
121
122
    /**
123
    * @param array<int, int> $value
124
    */
125 1
    public function SetUserInteractionCount(array $value) : void
126
    {
127 1
        $this->NudgePropertyWithUniqueIntegers(
128 1
            'userInteractionCount',
129 1
            __METHOD__,
130 1
            $value
131
        );
132 1
    }
133
}
134