Passed
Push — master ( b7b55a...a74c74 )
by SignpostMarv
11:14
created

WebPage   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 272
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 100
dl 0
loc 272
ccs 90
cts 90
cp 1
rs 10
c 0
b 0
f 0
wmc 16

16 Methods

Rating   Name   Duplication   Size   Complexity  
A GetPrimaryImageOfPage() 0 12 1
A GetMainContentOfPage() 0 12 1
A GetReviewedBy() 0 12 1
A GetSignificantLink() 0 12 1
A GetLastReviewed() 0 12 1
A GetRelatedLink() 0 12 1
A GetSpecialty() 0 12 1
A GetBreadcrumb() 0 12 1
A SetSignificantLink() 0 6 1
A SetSpecialty() 0 5 1
A SetReviewedBy() 0 5 1
A SetRelatedLink() 0 6 1
A SetBreadcrumb() 0 6 1
A SetMainContentOfPage() 0 5 1
A SetPrimaryImageOfPage() 0 5 1
A SetLastReviewed() 0 5 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\CreativeWork;
8
9
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork as Base;
10
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
11
use SignpostMarv\DaftObject\SchemaOrg\DataTypes\Date;
12
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Enumeration\Specialty;
13
use SignpostMarv\DaftObject\SchemaOrg\Intangible\ItemList\BreadcrumbList;
14
use SignpostMarv\DaftObject\SchemaOrg\Intangible\SpeakableSpecification;
15
use SignpostMarv\DaftObject\SchemaOrg\Organization;
16
use SignpostMarv\DaftObject\SchemaOrg\Person;
17
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
18
19
/**
20
* @property array<int, string|BreadcrumbList> $breadcrumb
21
* @property array<int, Date> $lastReviewed
22
* @property array<int, WebPageElement> $mainContentOfPage
23
* @property array<int, MediaObject\ImageObject> $primaryImageOfPage
24
* @property array<int, string> $relatedLink
25
* @property array<int, Organization|Person> $reviewedBy
26
* @property array<int, string> $significantLink
27
* @property array<int, string|SpeakableSpecification> $speakable
28
* @property array<int, Specialty> $specialty
29
*/
30
class WebPage extends Base
31
{
32
    use DaftObjectTraits\HasSpeakable;
33
34
    const SCHEMA_ORG_TYPE = 'WebPage';
35
36
    const PROPERTIES = [
37
        'breadcrumb',
38
        'lastReviewed',
39
        'mainContentOfPage',
40
        'primaryImageOfPage',
41
        'relatedLink',
42
        'reviewedBy',
43
        'significantLink',
44
        'speakable',
45
        'specialty',
46
    ];
47
48
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
49
        'breadcrumb' => [
50
            'string',
51
            BreadcrumbList::class,
52
        ],
53
        'lastReviewed' => [
54
            Date::class,
55
        ],
56
        'mainContentOfPage' => [
57
            WebPageElement::class,
58
        ],
59
        'primaryImageOfPage' => [
60
            MediaObject\ImageObject::class,
61
        ],
62
        'relatedLink' => [
63
            'string',
64
        ],
65
        'reviewedBy' => [
66
            Organization::class,
67
            Person::class,
68
        ],
69
        'significantLink' => [
70
            'string',
71
        ],
72
        'speakable' => TypeUtilities::MULTI_TYPE_DICT__speakable,
73
        'specialty' => [
74
            Specialty::class,
75
        ],
76
    ];
77
78
    /**
79
    * @return array<int, string|BreadcrumbList>
80
    */
81 8
    public function GetBreadcrumb() : array
82
    {
83
        /**
84
        * @var array<int, string|BreadcrumbList>
85
        */
86 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
87 8
            'breadcrumb',
88 8
            $this->RetrievePropertyValueFromData('breadcrumb'),
89 8
            static::class
90
        );
91
92 8
        return $out;
93
    }
94
95
    /**
96
    * @param array<int, string|BreadcrumbList> $value
97
    */
98 2
    public function SetBreadcrumb(array $value) : void
99
    {
100 2
        $this->NudgePropertyValue(
101 2
            'breadcrumb',
102 2
            $value,
103 2
            true
104
        );
105 2
    }
106
107
    /**
108
    * @return array<int, Date>
109
    */
110 8
    public function GetLastReviewed() : array
111
    {
112
        /**
113
        * @var array<int, Date>
114
        */
115 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
116 8
            'lastReviewed',
117 8
            $this->RetrievePropertyValueFromData('lastReviewed'),
118 8
            static::class
119
        );
120
121 8
        return $out;
122
    }
123
124
    /**
125
    * @param array<int, Date> $value
126
    */
127 2
    public function SetLastReviewed(array $value) : void
128
    {
129 2
        $this->NudgePropertyValue(
130 2
            'lastReviewed',
131 2
            $value
132
        );
133 2
    }
134
135
    /**
136
    * @return array<int, WebPageElement>
137
    */
138 8
    public function GetMainContentOfPage() : array
139
    {
140
        /**
141
        * @var array<int, WebPageElement>
142
        */
143 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
144 8
            'mainContentOfPage',
145 8
            $this->RetrievePropertyValueFromData('mainContentOfPage'),
146 8
            static::class
147
        );
148
149 8
        return $out;
150
    }
151
152
    /**
153
    * @param array<int, WebPageElement> $value
154
    */
155 2
    public function SetMainContentOfPage(array $value) : void
156
    {
157 2
        $this->NudgePropertyValue(
158 2
            'mainContentOfPage',
159 2
            $value
160
        );
161 2
    }
162
163
    /**
164
    * @return array<int, MediaObject\ImageObject>
165
    */
166 8
    public function GetPrimaryImageOfPage() : array
167
    {
168
        /**
169
        * @var array<int, MediaObject\ImageObject>
170
        */
171 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
172 8
            'primaryImageOfPage',
173 8
            $this->RetrievePropertyValueFromData('primaryImageOfPage'),
174 8
            static::class
175
        );
176
177 8
        return $out;
178
    }
179
180
    /**
181
    * @param array<int, MediaObject\ImageObject> $value
182
    */
183 2
    public function SetPrimaryImageOfPage(array $value) : void
184
    {
185 2
        $this->NudgePropertyValue(
186 2
            'primaryImageOfPage',
187 2
            $value
188
        );
189 2
    }
190
191
    /**
192
    * @return array<int, string>
193
    */
194 8
    public function GetRelatedLink() : array
195
    {
196
        /**
197
        * @var array<int, string>
198
        */
199 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
200 8
            'relatedLink',
201 8
            $this->RetrievePropertyValueFromData('relatedLink'),
202 8
            static::class
203
        );
204
205 8
        return $out;
206
    }
207
208
    /**
209
    * @param array<int, string> $value
210
    */
211 2
    public function SetRelatedLink(array $value) : void
212
    {
213 2
        $this->NudgePropertyValue(
214 2
            'relatedLink',
215 2
            $value,
216 2
            true
217
        );
218 2
    }
219
220
    /**
221
    * @return array<int, Organization|Person>
222
    */
223 8
    public function GetReviewedBy() : array
224
    {
225
        /**
226
        * @var array<int, Organization|Person>
227
        */
228 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
229 8
            'reviewedBy',
230 8
            $this->RetrievePropertyValueFromData('reviewedBy'),
231 8
            static::class
232
        );
233
234 8
        return $out;
235
    }
236
237
    /**
238
    * @param array<int, Organization|Person> $value
239
    */
240 2
    public function SetReviewedBy(array $value) : void
241
    {
242 2
        $this->NudgePropertyValue(
243 2
            'reviewedBy',
244 2
            $value
245
        );
246 2
    }
247
248
    /**
249
    * @return array<int, string>
250
    */
251 8
    public function GetSignificantLink() : array
252
    {
253
        /**
254
        * @var array<int, string>
255
        */
256 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
257 8
            'significantLink',
258 8
            $this->RetrievePropertyValueFromData('significantLink'),
259 8
            static::class
260
        );
261
262 8
        return $out;
263
    }
264
265
    /**
266
    * @param array<int, string> $value
267
    */
268 2
    public function SetSignificantLink(array $value) : void
269
    {
270 2
        $this->NudgePropertyValue(
271 2
            'significantLink',
272 2
            $value,
273 2
            true
274
        );
275 2
    }
276
277
    /**
278
    * @return array<int, Specialty>
279
    */
280 8
    public function GetSpecialty() : array
281
    {
282
        /**
283
        * @var array<int, Specialty>
284
        */
285 8
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
286 8
            'specialty',
287 8
            $this->RetrievePropertyValueFromData('specialty'),
288 8
            static::class
289
        );
290
291 8
        return $out;
292
    }
293
294
    /**
295
    * @param array<int, Specialty> $value
296
    */
297 2
    public function SetSpecialty(array $value) : void
298
    {
299 2
        $this->NudgePropertyValue(
300 2
            'specialty',
301 2
            $value
302
        );
303 2
    }
304
}
305