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

Action   A

Complexity

Total Complexity 20

Size/Duplication

Total Lines 359
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 144
dl 0
loc 359
ccs 131
cts 131
cp 1
rs 10
c 0
b 0
f 0
wmc 20

20 Methods

Rating   Name   Duplication   Size   Complexity  
A GetAgent() 0 12 1
A GetTarget() 0 12 1
A GetActionStatus() 0 12 1
A SetError() 0 7 1
A SetObject() 0 7 1
A SetAgent() 0 8 1
A GetResult() 0 12 1
A GetInstrument() 0 12 1
A SetResult() 0 7 1
A GetEndTime() 0 12 1
A SetParticipant() 0 8 1
A SetEndTime() 0 7 1
A SetActionStatus() 0 7 1
A SetTarget() 0 7 1
A GetObject() 0 12 1
A SetInstrument() 0 7 1
A SetStartTime() 0 7 1
A GetParticipant() 0 12 1
A GetStartTime() 0 12 1
A GetError() 0 12 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg;
8
9
use SignpostMarv\DaftObject\SchemaOrg\DataTypes\DateTime;
10
use SignpostMarv\DaftObject\SchemaOrg\Intangible\EntryPoint;
11
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Enumeration\ActionStatusType;
12
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\ContactPoint\PostalAddress;
13
14
/**
15
* @property array<int, ActionStatusType> $actionStatus
16
* @property array<int, Organization|Person> $agent
17
* @property array<int, DateTime> $endTime
18
* @property array<int, Thing> $error
19
* @property array<int, Thing> $instrument
20
* @property array<int, string|Place|PostalAddress> $location
21
* @property array<int, Thing> $object
22
* @property array<int, Organization|Person> $participant
23
* @property array<int, Thing> $result
24
* @property array<int, DateTime> $startTime
25
* @property array<int, EntryPoint> $target
26
*/
27
class Action extends Thing
28
{
29
    use DaftObjectTraits\HasLocation;
30
31
    const SCHEMA_ORG_TYPE = 'Action';
32
33
    const PROPERTIES = [
34
        'actionStatus',
35
        'agent',
36
        'endTime',
37
        'error',
38
        'instrument',
39
        'location',
40
        'object',
41
        'participant',
42
        'result',
43
        'startTime',
44
        'target',
45
    ];
46
47
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
48
        'actionStatus' => [
49
            ActionStatusType::class,
50
        ],
51
        'agent' => [
52
            Organization::class,
53
            Person::class,
54
        ],
55
        'endTime' => [
56
            DateTime::class,
57
        ],
58
        'error' => [
59
            Thing::class,
60
        ],
61
        'instrument' => [
62
            Thing::class,
63
        ],
64
        'location' => [
65
            'string',
66
            Place::class,
67
            PostalAddress::class,
68
        ],
69
        'object' => [
70
            Thing::class,
71
        ],
72
        'participant' => [
73
            Organization::class,
74
            Person::class,
75
        ],
76
        'result' => [
77
            Thing::class,
78
        ],
79
        'startTime' => [
80
            DateTime::class,
81
        ],
82
        'target' => [
83
            EntryPoint::class,
84
        ],
85
    ];
86
87
    /**
88
    * @return array<int, ActionStatusType>
89
    */
90 225
    public function GetActionStatus() : array
91
    {
92
        /**
93
        * @var array<int, ActionStatusType>
94
        */
95 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
96 225
            'actionStatus',
97 225
            $this->RetrievePropertyValueFromData('actionStatus'),
98 225
            static::class
99
        );
100
101 225
        return $out;
102
    }
103
104
    /**
105
    * @param array<int, ActionStatusType> $value
106
    */
107 1
    public function SetActionStatus(array $value) : void
108
    {
109 1
        $this->NudgePropertyWithUniqueValuesOfThings(
110 1
            'actionStatus',
111 1
            __METHOD__,
112 1
            $value,
113 1
            ActionStatusType::class
114
        );
115 1
    }
116
117
    /**
118
    * @return array<int, Organization|Person>
119
    */
120 225
    public function GetAgent() : array
121
    {
122
        /**
123
        * @var array<int, Organization|Person>
124
        */
125 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
126 225
            'agent',
127 225
            $this->RetrievePropertyValueFromData('agent'),
128 225
            static::class
129
        );
130
131 225
        return $out;
132
    }
133
134
    /**
135
    * @param array<int, Organization|Person> $value
136
    */
137 1
    public function SetAgent(array $value) : void
138
    {
139 1
        $this->NudgePropertyWithUniqueValuesOfThings(
140 1
            'agent',
141 1
            __METHOD__,
142 1
            $value,
143 1
            Organization::class,
144 1
            Person::class
145
        );
146 1
    }
147
148
    /**
149
    * @return array<int, DateTime>
150
    */
151 225
    public function GetEndTime() : array
152
    {
153
        /**
154
        * @var array<int, DateTime>
155
        */
156 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
157 225
            'endTime',
158 225
            $this->RetrievePropertyValueFromData('endTime'),
159 225
            static::class
160
        );
161
162 225
        return $out;
163
    }
164
165
    /**
166
    * @param array<int, DateTime> $value
167
    */
168 1
    public function SetEndTime(array $value) : void
169
    {
170 1
        $this->NudgePropertyWithUniqueValuesOfThings(
171 1
            'endTime',
172 1
            __METHOD__,
173 1
            $value,
174 1
            DateTime::class
175
        );
176 1
    }
177
178
    /**
179
    * @return array<int, Thing>
180
    */
181 225
    public function GetError() : array
182
    {
183
        /**
184
        * @var array<int, Thing>
185
        */
186 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
187 225
            'error',
188 225
            $this->RetrievePropertyValueFromData('error'),
189 225
            static::class
190
        );
191
192 225
        return $out;
193
    }
194
195
    /**
196
    * @param array<int, Thing> $value
197
    */
198 1
    public function SetError(array $value) : void
199
    {
200 1
        $this->NudgePropertyWithUniqueValuesOfThings(
201 1
            'error',
202 1
            __METHOD__,
203 1
            $value,
204 1
            Thing::class
205
        );
206 1
    }
207
208
    /**
209
    * @return array<int, Thing>
210
    */
211 225
    public function GetInstrument() : array
212
    {
213
        /**
214
        * @var array<int, Thing>
215
        */
216 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
217 225
            'instrument',
218 225
            $this->RetrievePropertyValueFromData('instrument'),
219 225
            static::class
220
        );
221
222 225
        return $out;
223
    }
224
225
    /**
226
    * @param array<int, Thing> $value
227
    */
228 1
    public function SetInstrument(array $value) : void
229
    {
230 1
        $this->NudgePropertyWithUniqueValuesOfThings(
231 1
            'instrument',
232 1
            __METHOD__,
233 1
            $value,
234 1
            Thing::class
235
        );
236 1
    }
237
238
    /**
239
    * @return array<int, Thing>
240
    */
241 225
    public function GetObject() : array
242
    {
243
        /**
244
        * @var array<int, Thing>
245
        */
246 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
247 225
            'object',
248 225
            $this->RetrievePropertyValueFromData('object'),
249 225
            static::class
250
        );
251
252 225
        return $out;
253
    }
254
255
    /**
256
    * @param array<int, Thing> $value
257
    */
258 1
    public function SetObject(array $value) : void
259
    {
260 1
        $this->NudgePropertyWithUniqueValuesOfThings(
261 1
            'object',
262 1
            __METHOD__,
263 1
            $value,
264 1
            Thing::class
265
        );
266 1
    }
267
268
    /**
269
    * @return array<int, Organization|Person>
270
    */
271 225
    public function GetParticipant() : array
272
    {
273
        /**
274
        * @var array<int, Organization|Person>
275
        */
276 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
277 225
            'participant',
278 225
            $this->RetrievePropertyValueFromData('participant'),
279 225
            static::class
280
        );
281
282 225
        return $out;
283
    }
284
285
    /**
286
    * @param array<int, Organization|Person> $value
287
    */
288 1
    public function SetParticipant(array $value) : void
289
    {
290 1
        $this->NudgePropertyWithUniqueValuesOfThings(
291 1
            'participant',
292 1
            __METHOD__,
293 1
            $value,
294 1
            Organization::class,
295 1
            Person::class
296
        );
297 1
    }
298
299
    /**
300
    * @return array<int, Thing>
301
    */
302 225
    public function GetResult() : array
303
    {
304
        /**
305
        * @var array<int, Thing>
306
        */
307 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
308 225
            'result',
309 225
            $this->RetrievePropertyValueFromData('result'),
310 225
            static::class
311
        );
312
313 225
        return $out;
314
    }
315
316
    /**
317
    * @param array<int, Thing> $value
318
    */
319 1
    public function SetResult(array $value) : void
320
    {
321 1
        $this->NudgePropertyWithUniqueValuesOfThings(
322 1
            'result',
323 1
            __METHOD__,
324 1
            $value,
325 1
            Thing::class
326
        );
327 1
    }
328
329
    /**
330
    * @return array<int, DateTime>
331
    */
332 225
    public function GetStartTime() : array
333
    {
334
        /**
335
        * @var array<int, DateTime>
336
        */
337 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
338 225
            'startTime',
339 225
            $this->RetrievePropertyValueFromData('startTime'),
340 225
            static::class
341
        );
342
343 225
        return $out;
344
    }
345
346
    /**
347
    * @param array<int, DateTime> $value
348
    */
349 1
    public function SetStartTime(array $value) : void
350
    {
351 1
        $this->NudgePropertyWithUniqueValuesOfThings(
352 1
            'startTime',
353 1
            __METHOD__,
354 1
            $value,
355 1
            DateTime::class
356
        );
357 1
    }
358
359
    /**
360
    * @return array<int, EntryPoint>
361
    */
362 225
    public function GetTarget() : array
363
    {
364
        /**
365
        * @var array<int, EntryPoint>
366
        */
367 225
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
368 225
            'target',
369 225
            $this->RetrievePropertyValueFromData('target'),
370 225
            static::class
371
        );
372
373 225
        return $out;
374
    }
375
376
    /**
377
    * @param array<int, EntryPoint> $value
378
    */
379 1
    public function SetTarget(array $value) : void
380
    {
381 1
        $this->NudgePropertyWithUniqueValuesOfThings(
382 1
            'target',
383 1
            __METHOD__,
384 1
            $value,
385 1
            EntryPoint::class
386
        );
387 1
    }
388
}
389