Passed
Push — master ( 669ccb...85dfa5 )
by SignpostMarv
04:19
created

Article   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 246
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 95
dl 0
loc 246
ccs 83
cts 83
cp 1
rs 10
c 0
b 0
f 0
wmc 14

14 Methods

Rating   Name   Duplication   Size   Complexity  
A SetPageStart() 0 6 1
A SetPagination() 0 6 1
A GetArticleSection() 0 12 1
A SetPageEnd() 0 6 1
A GetPageEnd() 0 12 1
A GetWordCount() 0 12 1
A GetPageStart() 0 12 1
A GetPagination() 0 12 1
A GetBackstory() 0 12 1
A SetWordCount() 0 6 1
A SetBackstory() 0 6 1
A SetArticleBody() 0 6 1
A SetArticleSection() 0 6 1
A GetArticleBody() 0 12 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\Intangible\SpeakableSpecification;
12
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
13
14
/**
15
* @property array<int, string> $articleBody
16
* @property array<int, string> $articleSection
17
* @property array<int, string|Base> $backstory
18
* @property array<int, int|string> $pageEnd
19
* @property array<int, int|string> $pageStart
20
* @property array<int, string> $pagination
21
* @property array<int, string|SpeakableSpecification> $speakable
22
* @property array<int, int|string> $wordCount
23
*/
24
class Article extends Base
25
{
26
    use DaftObjectTraits\HasSpeakable;
27
28
    const SCHEMA_ORG_TYPE = 'Article';
29
30
    const PROPERTIES = [
31
        'articleBody',
32
        'articleSection',
33
        'backstory',
34
        'pageEnd',
35
        'pageStart',
36
        'pagination',
37
        'speakable',
38
        'wordCount',
39
    ];
40
41
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
42
        'articleBody' => [
43
            'string',
44
        ],
45
        'articleSection' => [
46
            'string',
47
        ],
48
        'backstory' => [
49
            'string',
50
            Base::class,
51
        ],
52
        'pageEnd' => [
53
            'integer',
54
            'string',
55
        ],
56
        'pageStart' => [
57
            'integer',
58
            'string',
59
        ],
60
        'pagination' => [
61
            'string',
62
        ],
63
        'speakable' => TypeUtilities::MULTI_TYPE_DICT__speakable,
64
        'wordCount' => [
65
            'integer',
66
            'string',
67
        ],
68
    ];
69
70
    /**
71
    * @return array<int, string>
72
    */
73 2
    public function GetArticleBody() : array
74
    {
75
        /**
76
        * @var array<int, string>
77
        */
78 2
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
79 2
            'articleBody',
80 2
            $this->RetrievePropertyValueFromData('articleBody'),
81 2
            static::class
82
        );
83
84 2
        return $out;
85
    }
86
87
    /**
88
    * @param array<int, string> $value
89
    */
90 1
    public function SetArticleBody(array $value) : void
91
    {
92 1
        $this->NudgePropertyValue(
93 1
            'articleBody',
94 1
            $value,
95 1
            true
96
        );
97 1
    }
98
99
    /**
100
    * @return array<int, string>
101
    */
102 2
    public function GetArticleSection() : array
103
    {
104
        /**
105
        * @var array<int, string>
106
        */
107 2
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
108 2
            'articleSection',
109 2
            $this->RetrievePropertyValueFromData('articleSection'),
110 2
            static::class
111
        );
112
113 2
        return $out;
114
    }
115
116
    /**
117
    * @param array<int, string> $value
118
    */
119 1
    public function SetArticleSection(array $value) : void
120
    {
121 1
        $this->NudgePropertyValue(
122 1
            'articleSection',
123 1
            $value,
124 1
            true
125
        );
126 1
    }
127
128
    /**
129
    * @return array<int, string|Base>
130
    */
131 2
    public function GetBackstory() : array
132
    {
133
        /**
134
        * @var array<int, string|Base>
135
        */
136 2
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
137 2
            'backstory',
138 2
            $this->RetrievePropertyValueFromData('backstory'),
139 2
            static::class
140
        );
141
142 2
        return $out;
143
    }
144
145
    /**
146
    * @param array<int, string|Base> $value
147
    */
148 1
    public function SetBackstory(array $value) : void
149
    {
150 1
        $this->NudgePropertyValue(
151 1
            'backstory',
152 1
            $value,
153 1
            true
154
        );
155 1
    }
156
157
    /**
158
    * @return array<int, int|string>
159
    */
160 2
    public function GetPageEnd() : array
161
    {
162
        /**
163
        * @var array<int, int|string>
164
        */
165 2
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
166 2
            'pageEnd',
167 2
            $this->RetrievePropertyValueFromData('pageEnd'),
168 2
            static::class
169
        );
170
171 2
        return $out;
172
    }
173
174
    /**
175
    * @param array<int, int|string> $value
176
    */
177 1
    public function SetPageEnd(array $value) : void
178
    {
179 1
        $this->NudgePropertyValue(
180 1
            'pageEnd',
181 1
            $value,
182 1
            true
183
        );
184 1
    }
185
186
    /**
187
    * @return array<int, int|string>
188
    */
189 2
    public function GetPageStart() : array
190
    {
191
        /**
192
        * @var array<int, int|string>
193
        */
194 2
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
195 2
            'pageStart',
196 2
            $this->RetrievePropertyValueFromData('pageStart'),
197 2
            static::class
198
        );
199
200 2
        return $out;
201
    }
202
203
    /**
204
    * @param array<int, int|string> $value
205
    */
206 1
    public function SetPageStart(array $value) : void
207
    {
208 1
        $this->NudgePropertyValue(
209 1
            'pageStart',
210 1
            $value,
211 1
            true
212
        );
213 1
    }
214
215
    /**
216
    * @return array<int, string>
217
    */
218 2
    public function GetPagination() : array
219
    {
220
        /**
221
        * @var array<int, string>
222
        */
223 2
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
224 2
            'pagination',
225 2
            $this->RetrievePropertyValueFromData('pagination'),
226 2
            static::class
227
        );
228
229 2
        return $out;
230
    }
231
232
    /**
233
    * @param array<int, string> $value
234
    */
235 1
    public function SetPagination(array $value) : void
236
    {
237 1
        $this->NudgePropertyValue(
238 1
            'pagination',
239 1
            $value,
240 1
            true
241
        );
242 1
    }
243
244
    /**
245
    * @return array<int, int>
246
    */
247 2
    public function GetWordCount() : array
248
    {
249
        /**
250
        * @var array<int, int>
251
        */
252 2
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
253 2
            'wordCount',
254 2
            $this->RetrievePropertyValueFromData('wordCount'),
255 2
            static::class
256
        );
257
258 2
        return $out;
259
    }
260
261
    /**
262
    * @param array<int, int> $value
263
    */
264 1
    public function SetWordCount(array $value) : void
265
    {
266 1
        $this->NudgePropertyWithUniqueIntegers(
267 1
            'wordCount',
268 1
            __METHOD__,
269 1
            $value
270
        );
271 1
    }
272
}
273