QueryResult::getAbstractSource()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Nkey\DDG\API\Model;
3
4
/**
5
 * Model for the result of an api query
6
 *
7
 * @author Maik Greubel <[email protected]>
8
 */
9
class QueryResult
10
{
11
12
    /**
13
     *
14
     * @var string
15
     */
16
    private $definitionSource;
17
18
    /**
19
     *
20
     * @var string
21
     */
22
    private $heading;
23
24
    /**
25
     *
26
     * @var int
27
     */
28
    private $imageWidth;
29
30
    /**
31
     *
32
     * @var array
33
     */
34
    private $relatedTopics;
35
36
    /**
37
     *
38
     * @var string
39
     */
40
    private $entity;
41
42
    /**
43
     *
44
     * @var Metadata
45
     */
46
    private $meta;
47
48
    /**
49
     *
50
     * @var string
51
     */
52
    private $type;
53
54
    /**
55
     *
56
     * @var string
57
     */
58
    private $redirect;
59
60
    /**
61
     *
62
     * @var string
63
     */
64
    private $definitionURL;
65
66
    /**
67
     *
68
     * @var string
69
     */
70
    private $abstractURL;
71
72
    /**
73
     *
74
     * @var string
75
     */
76
    private $definition;
77
78
    /**
79
     *
80
     * @var string
81
     */
82
    private $abstractSource;
83
84
    /**
85
     *
86
     * @var string
87
     */
88
    private $infobox;
89
90
    /**
91
     *
92
     * @var string
93
     */
94
    private $image;
95
96
    /**
97
     *
98
     * @var bool
99
     */
100
    private $imageIsLogo;
101
102
    /**
103
     *
104
     * @var string
105
     */
106
    private $abstract;
107
108
    /**
109
     *
110
     * @var string
111
     */
112
    private $abstractText;
113
114
    /**
115
     *
116
     * @var string
117
     */
118
    private $answerType;
119
120
    /**
121
     *
122
     * @var int
123
     */
124
    private $imageHeight;
125
126
    /**
127
     *
128
     * @var string
129
     */
130
    private $answer;
131
132
    /**
133
     *
134
     * @var array
135
     */
136
    private $results;
137
138
    /**
139
     *
140
     * @return string
141
     */
142 1
    public function getDefinitionSource(): string
143
    {
144 1
        return $this->definitionSource;
145
    }
146
147
    /**
148
     *
149
     * @param string $definitionSource
150
     * @return QueryResult
151
     */
152 3
    public function setDefinitionSource(string $definitionSource): QueryResult
153
    {
154 3
        $this->definitionSource = $definitionSource;
155 3
        return $this;
156
    }
157
158
    /**
159
     *
160
     * @return string
161
     */
162 1
    public function getHeading(): string
163
    {
164 1
        return $this->heading;
165
    }
166
167
    /**
168
     *
169
     * @param string $heading
170
     * @return QueryResult
171
     */
172 3
    public function setHeading(string $heading): QueryResult
173
    {
174 3
        $this->heading = $heading;
175 3
        return $this;
176
    }
177
178
    /**
179
     *
180
     * @return int
181
     */
182 1
    public function getImageWidth(): int
183
    {
184 1
        return $this->imageWidth;
185
    }
186
187
    /**
188
     *
189
     * @param int $imageWidth
190
     * @return QueryResult
191
     */
192 3
    public function setImageWidth(int $imageWidth): QueryResult
193
    {
194 3
        $this->imageWidth = $imageWidth;
195 3
        return $this;
196
    }
197
198
    /**
199
     *
200
     * @return mixed
201
     */
202 1
    public function getEntity(): string
203
    {
204 1
        return $this->entity;
205
    }
206
207
    /**
208
     *
209
     * @param string $entity
210
     * @return QueryResult
211
     */
212 3
    public function setEntity(string $entity): QueryResult
213
    {
214 3
        $this->entity = $entity;
215 3
        return $this;
216
    }
217
218
    /**
219
     *
220
     * @return Metadata
221
     */
222 1
    public function getMeta(): Metadata
223
    {
224 1
        return $this->meta == null ? new Metadata() : $this->meta;
225
    }
226
227
    /**
228
     *
229
     * @param Metadata $meta
230
     * @return QueryResult
231
     */
232
    public function setMeta(Metadata $meta): QueryResult
233
    {
234
        $this->meta = $meta;
235
        return $this;
236
    }
237
238
    /**
239
     *
240
     * @return string
241
     */
242 1
    public function getType(): string
243
    {
244 1
        return $this->type;
245
    }
246
247
    /**
248
     *
249
     * @param string $type
250
     * @return QueryResult
251
     */
252 3
    public function setType(string $type): QueryResult
253
    {
254 3
        $this->type = $type;
255 3
        return $this;
256
    }
257
258
    /**
259
     *
260
     * @return string
261
     */
262 1
    public function getRedirect(): string
263
    {
264 1
        return $this->redirect;
265
    }
266
267
    /**
268
     *
269
     * @param string $redirect
270
     * @return QueryResult
271
     */
272 3
    public function setRedirect(string $redirect): QueryResult
273
    {
274 3
        $this->redirect = $redirect;
275 3
        return $this;
276
    }
277
278
    /**
279
     *
280
     * @return string
281
     */
282 1
    public function getDefinitionURL(): string
283
    {
284 1
        return $this->definitionURL;
285
    }
286
287
    /**
288
     *
289
     * @param string $definitionURL
290
     * @return QueryResult
291
     */
292 3
    public function setDefinitionURL(string $definitionURL): QueryResult
293
    {
294 3
        $this->definitionURL = $definitionURL;
295 3
        return $this;
296
    }
297
298
    /**
299
     *
300
     * @return string
301
     */
302 1
    public function getAbstractURL(): string
303
    {
304 1
        return $this->abstractURL;
305
    }
306
307
    /**
308
     *
309
     * @param string $abstractURL
310
     * @return QueryResult
311
     */
312 3
    public function setAbstractURL(string $abstractURL): QueryResult
313
    {
314 3
        $this->abstractURL = $abstractURL;
315 3
        return $this;
316
    }
317
318
    /**
319
     *
320
     * @return string
321
     */
322 1
    public function getDefinition(): string
323
    {
324 1
        return $this->definition;
325
    }
326
327
    /**
328
     *
329
     * @param string $definition
330
     * @return QueryResult
331
     */
332 3
    public function setDefinition(string $definition): QueryResult
333
    {
334 3
        $this->definition = $definition;
335 3
        return $this;
336
    }
337
338
    /**
339
     *
340
     * @return string
341
     */
342 1
    public function getAbstractSource(): string
343
    {
344 1
        return $this->abstractSource;
345
    }
346
347
    /**
348
     *
349
     * @param string $abstractSource
350
     * @return QueryResult
351
     */
352 3
    public function setAbstractSource(string $abstractSource): QueryResult
353
    {
354 3
        $this->abstractSource = $abstractSource;
355 3
        return $this;
356
    }
357
358
    /**
359
     *
360
     * @return string
361
     */
362 1
    public function getInfobox(): string
363
    {
364 1
        return $this->infobox;
365
    }
366
367
    /**
368
     *
369
     * @param string $infobox
370
     * @return QueryResult
371
     */
372 3
    public function setInfobox(string $infobox): QueryResult
373
    {
374 3
        $this->infobox = $infobox;
375 3
        return $this;
376
    }
377
378
    /**
379
     *
380
     * @return string
381
     */
382 1
    public function getImage(): string
383
    {
384 1
        return $this->image;
385
    }
386
387
    /**
388
     *
389
     * @param string $image
390
     * @return QueryResult
391
     */
392 3
    public function setImage(string $image): QueryResult
393
    {
394 3
        $this->image = $image;
395 3
        return $this;
396
    }
397
398
    /**
399
     *
400
     * @return bool
401
     */
402 1
    public function isImageIsLogo(): bool
403
    {
404 1
        return $this->imageIsLogo;
405
    }
406
407
    /**
408
     *
409
     * @param bool $imageIsLogo
410
     * @return QueryResult
411
     */
412 3
    public function setImageIsLogo(bool $imageIsLogo): QueryResult
413
    {
414 3
        $this->imageIsLogo = $imageIsLogo;
415 3
        return $this;
416
    }
417
418
    /**
419
     *
420
     * @return string
421
     */
422 1
    public function getAbstract(): string
423
    {
424 1
        return $this->abstract;
425
    }
426
427
    /**
428
     *
429
     * @param string $abstract
430
     * @return QueryResult
431
     */
432 3
    public function setAbstract(string $abstract): QueryResult
433
    {
434 3
        $this->abstract = $abstract;
435 3
        return $this;
436
    }
437
438
    /**
439
     *
440
     * @return string
441
     */
442 1
    public function getAbstractText(): string
443
    {
444 1
        return $this->abstractText;
445
    }
446
447
    /**
448
     *
449
     * @param string $abstractText
450
     * @return QueryResult
451
     */
452 3
    public function setAbstractText(string $abstractText): QueryResult
453
    {
454 3
        $this->abstractText = $abstractText;
455 3
        return $this;
456
    }
457
458
    /**
459
     *
460
     * @return string
461
     */
462 1
    public function getAnswerType(): string
463
    {
464 1
        return $this->answerType;
465
    }
466
467
    /**
468
     *
469
     * @param string $answerType
470
     * @return QueryResult
471
     */
472 3
    public function setAnswerType(string $answerType): QueryResult
473
    {
474 3
        $this->answerType = $answerType;
475 3
        return $this;
476
    }
477
478
    /**
479
     *
480
     * @return int
481
     */
482 1
    public function getImageHeight(): int
483
    {
484 1
        return $this->imageHeight;
485
    }
486
487
    /**
488
     *
489
     * @param int $imageHeight
490
     * @return QueryResult
491
     */
492 3
    public function setImageHeight(int $imageHeight): QueryResult
493
    {
494 3
        $this->imageHeight = $imageHeight;
495 3
        return $this;
496
    }
497
498
    /**
499
     *
500
     * @return string
501
     */
502 1
    public function getAnswer(): string
503
    {
504 1
        return $this->answer;
505
    }
506
507
    /**
508
     *
509
     * @param string $answer
510
     * @return QueryResult
511
     */
512 3
    public function setAnswer($answer): QueryResult
513
    {
514 3
        $this->answer = $answer;
515 3
        return $this;
516
    }
517
518
    /**
519
     *
520
     * @return array
521
     */
522 2
    public function getRelatedTopics(): array
523
    {
524 2
        return $this->relatedTopics;
525
    }
526
527
    /**
528
     *
529
     * @return array
530
     */
531 2
    public function getResults(): array
532
    {
533 2
        return $this->results == null ? array() : $this->results;
534
    }
535
536
    /**
537
     *
538
     * @param Result $result
539
     * @return QueryResult
540
     */
541 1
    public function addResult(Result $result): QueryResult
542
    {
543 1
        $this->results[] = $result;
544 1
        return $this;
545
    }
546
    
547
    /**
548
     * 
549
     * @param Result $topic
550
     * @return QueryResult
551
     */
552 3
    public function addRelatedTopic(Result $topic): QueryResult
553
    {
554 3
        $this->relatedTopics[] = $topic;
555 3
        return $this;
556
    }
557
}