InteractionCounter   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

6 Methods

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