Passed
Push — master ( df1a48...669ccb )
by SignpostMarv
04:37
created

InteractionCounter::SetInteractionService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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