Passed
Push — master ( 205e6e...6d0f47 )
by SignpostMarv
11:40
created

PublicationEvent::SetPublishedOn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
ccs 6
cts 6
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\Event;
8
9
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
10
use SignpostMarv\DaftObject\SchemaOrg\Event as Base;
11
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Service\BroadcastService;
12
use SignpostMarv\DaftObject\SchemaOrg\Organization;
13
use SignpostMarv\DaftObject\SchemaOrg\Person;
14
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
15
16
/**
17
* @property array<int, bool> $isAccessibleForFree
18
* @property array<int, Organization|Person> $publishedBy
19
* @property array<int, BroadcastService> $publishedOn
20
*/
21
class PublicationEvent extends Base
22
{
23
    use DaftObjectTraits\HasIsAccessibleForFree;
24
25
    const SCHEMA_ORG_TYPE = 'PublicationEvent';
26
27
    const PROPERTIES = [
28
        'isAccessibleForFree',
29
        'publishedBy',
30
        'publishedOn',
31
    ];
32
33
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
34
        'isAccessibleForFree' => [
35
            'boolean',
36
        ],
37
        'publishedBy' => [
38
            Organization::class,
39
            Person::class,
40
        ],
41
        'publishedOn' => [
42
            BroadcastService::class,
43
        ],
44
    ];
45
46
    /**
47
    * @return array<int, Organization|Person>
48
    */
49 65
    public function GetPublishedBy() : array
50
    {
51
        /**
52
        * @var array<int, Organization|Person>
53
        */
54 65
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
55 65
            'publishedBy',
56 65
            $this->RetrievePropertyValueFromData('publishedBy'),
57 65
            static::class
58
        );
59
60 65
        return $out;
61
    }
62
63
    /**
64
    * @param array<int, Organization|Person> $value
65
    */
66 1
    public function SetPublishedBy(array $value) : void
67
    {
68 1
        $this->NudgePropertyWithUniqueOrganizationsOrPersons('publishedBy', __METHOD__, $value);
69 1
    }
70
71
    /**
72
    * @return array<int, BroadcastService>
73
    */
74 65
    public function GetPublishedOn() : array
75
    {
76
        /**
77
        * @var array<int, BroadcastService>
78
        */
79 65
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
80 65
            'publishedOn',
81 65
            $this->RetrievePropertyValueFromData('publishedOn'),
82 65
            static::class
83
        );
84
85 65
        return $out;
86
    }
87
88
    /**
89
    * @param array<int, BroadcastService> $value
90
    */
91 1
    public function SetPublishedOn(array $value) : void
92
    {
93 1
        $this->NudgePropertyWithUniqueValuesOfThings(
94 1
            'publishedOn',
95 1
            __METHOD__,
96 1
            $value,
97 1
            BroadcastService::class
98
        );
99 1
    }
100
}
101