Passed
Branch develop (2fd4b5)
by Alexey
01:46
created

AppBuilder::setContainsAds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * @author   Ne-Lexa
6
 * @license  MIT
7
 * @link     https://github.com/Ne-Lexa/google-play-scraper
8
 */
9
10
namespace Nelexa\GPlay\Model\Builder;
11
12
use Nelexa\GPlay\Model\Category;
13
use Nelexa\GPlay\Model\Developer;
14
use Nelexa\GPlay\Model\GoogleImage;
15
use Nelexa\GPlay\Model\HistogramRating;
16
use Nelexa\GPlay\Model\Review;
17
use Nelexa\GPlay\Model\Video;
18
19
/**
20
 * App Builder.
21
 *
22
 * @internal
23
 */
24
class AppBuilder
25
{
26
    /**
27
     * @var string|null
28
     */
29
    private $id;
30
    /**
31
     * @var string|null
32
     */
33
    private $locale;
34
    /**
35
     * @var string|null
36
     */
37
    private $country;
38
    /**
39
     * @var string|null
40
     */
41
    private $name;
42
    /**
43
     * @var string|null
44
     */
45
    private $summary;
46
    /**
47
     * @var Developer|null
48
     */
49
    private $developer;
50
    /**
51
     * @var GoogleImage|null
52
     */
53
    private $icon;
54
    /**
55
     * @var float
56
     */
57
    private $score = 0.0;
58
    /**
59
     * @var string|null
60
     */
61
    private $priceText;
62
    /**
63
     * @var string|null
64
     */
65
    private $description;
66
    /**
67
     * @var string|null
68
     */
69
    private $translatedFromLocale;
70
    /**
71
     * @var GoogleImage|null
72
     */
73
    private $cover;
74
    /**
75
     * @var GoogleImage[]
76
     */
77
    private $screenshots = [];
78
    /**
79
     * @var Category|null
80
     */
81
    private $category;
82
    /**
83
     * @var string|null
84
     */
85
    private $privacyPoliceUrl;
86
    /**
87
     * @var Category|null
88
     */
89
    private $categoryFamily;
90
    /**
91
     * @var Video|null
92
     */
93
    private $video;
94
    /**
95
     * @var string|null
96
     */
97
    private $recentChanges;
98
    /**
99
     * @var bool
100
     */
101
    private $editorsChoice = false;
102
    /**
103
     * @var int
104
     */
105
    private $installs = 0;
106
    /**
107
     * @var int
108
     */
109
    private $numberVoters = 0;
110
    /**
111
     * @var HistogramRating|null
112
     */
113
    private $histogramRating;
114
    /**
115
     * @var float
116
     */
117
    private $price = 0;
118
    /**
119
     * @var string|null
120
     */
121
    private $currency;
122
    /**
123
     * @var string|null
124
     */
125
    private $offersIAPCost;
126
    /**
127
     * @var bool
128
     */
129
    private $containsAds = false;
130
    /**
131
     * @var string|null
132
     */
133
    private $size;
134
    /**
135
     * @var string|null
136
     */
137
    private $appVersion;
138
    /**
139
     * @var string|null
140
     */
141
    private $androidVersion;
142
    /**
143
     * @var string|null
144
     */
145
    private $minAndroidVersion;
146
    /**
147
     * @var string|null
148
     */
149
    private $contentRating;
150
    /**
151
     * @var \DateTimeInterface|null
152
     */
153
    private $released;
154
    /**
155
     * @var \DateTimeInterface|null
156
     */
157
    private $updated;
158
    /**
159
     * @var int
160
     */
161
    private $numberReviews = 0;
162
    /**
163
     * @var Review[]
164
     */
165
    private $reviews = [];
166
167
    /**
168
     * @return string|null
169
     */
170 13
    public function getId(): ?string
171
    {
172 13
        return $this->id;
173
    }
174
175
    /**
176
     * @param string $id
177
     * @return AppBuilder
178
     */
179 13
    public function setId(string $id): AppBuilder
180
    {
181 13
        $this->id = $id;
182 13
        return $this;
183
    }
184
185
    /**
186
     * @return string|null
187
     */
188 13
    public function getLocale(): ?string
189
    {
190 13
        return $this->locale;
191
    }
192
193
    /**
194
     * @param string|null $locale
195
     * @return AppBuilder
196
     */
197 13
    public function setLocale(?string $locale): AppBuilder
198
    {
199 13
        $this->locale = $locale;
200 13
        return $this;
201
    }
202
203
    /**
204
     * @return string|null
205
     */
206 13
    public function getCountry(): ?string
207
    {
208 13
        return $this->country;
209
    }
210
211
    /**
212
     * @param string|null $country
213
     * @return AppBuilder
214
     */
215 13
    public function setCountry(?string $country): AppBuilder
216
    {
217 13
        $this->country = $country;
218 13
        return $this;
219
    }
220
221
    /**
222
     * @return string|null
223
     */
224 13
    public function getName(): ?string
225
    {
226 13
        return $this->name;
227
    }
228
229
    /**
230
     * @param string|null $name
231
     * @return AppBuilder
232
     */
233 13
    public function setName(?string $name): AppBuilder
234
    {
235 13
        $this->name = $name;
236 13
        return $this;
237
    }
238
239
    /**
240
     * @return string|null
241
     */
242 13
    public function getSummary(): ?string
243
    {
244 13
        return $this->summary;
245
    }
246
247
    /**
248
     * @param string|null $summary
249
     * @return AppBuilder
250
     */
251 12
    public function setSummary(?string $summary): AppBuilder
252
    {
253 12
        $this->summary = $summary;
254 12
        return $this;
255
    }
256
257
    /**
258
     * @return Developer|null
259
     */
260 13
    public function getDeveloper(): ?Developer
261
    {
262 13
        return $this->developer;
263
    }
264
265
    /**
266
     * @param Developer|null $developer
267
     * @return AppBuilder
268
     */
269 13
    public function setDeveloper(?Developer $developer): AppBuilder
270
    {
271 13
        $this->developer = $developer;
272 13
        return $this;
273
    }
274
275
    /**
276
     * @return GoogleImage|null
277
     */
278 13
    public function getIcon(): ?GoogleImage
279
    {
280 13
        return $this->icon;
281
    }
282
283
    /**
284
     * @param GoogleImage|null $icon
285
     * @return AppBuilder
286
     */
287 13
    public function setIcon(?GoogleImage $icon): AppBuilder
288
    {
289 13
        $this->icon = $icon;
290 13
        return $this;
291
    }
292
293
    /**
294
     * @return float
295
     */
296 13
    public function getScore(): float
297
    {
298 13
        return $this->score;
299
    }
300
301
    /**
302
     * @param float $score
303
     * @return AppBuilder
304
     */
305 12
    public function setScore(float $score): AppBuilder
306
    {
307 12
        $this->score = $score;
308 12
        return $this;
309
    }
310
311
    /**
312
     * @return string|null
313
     */
314 13
    public function getPriceText(): ?string
315
    {
316 13
        return $this->priceText;
317
    }
318
319
    /**
320
     * @param string|null $priceText
321
     * @return AppBuilder
322
     */
323 12
    public function setPriceText(?string $priceText): AppBuilder
324
    {
325 12
        $this->priceText = $priceText;
326 12
        return $this;
327
    }
328
329
    /**
330
     * @return string|null
331
     */
332 9
    public function getDescription(): ?string
333
    {
334 9
        return $this->description;
335
    }
336
337
    /**
338
     * @param string|null $description
339
     * @return AppBuilder
340
     */
341 9
    public function setDescription(?string $description): AppBuilder
342
    {
343 9
        $this->description = $description;
344 9
        return $this;
345
    }
346
347
    /**
348
     * @return string|null
349
     */
350 9
    public function getTranslatedFromLocale(): ?string
351
    {
352 9
        return $this->translatedFromLocale;
353
    }
354
355
    /**
356
     * @param string|null $translatedFromLocale
357
     * @return AppBuilder
358
     */
359 8
    public function setTranslatedFromLocale(?string $translatedFromLocale): AppBuilder
360
    {
361 8
        $this->translatedFromLocale = $translatedFromLocale;
362 8
        return $this;
363
    }
364
365
    /**
366
     * @return GoogleImage|null
367
     */
368 9
    public function getCover(): ?GoogleImage
369
    {
370 9
        return $this->cover;
371
    }
372
373
    /**
374
     * @param GoogleImage|null $cover
375
     * @return AppBuilder
376
     */
377 8
    public function setCover(?GoogleImage $cover): AppBuilder
378
    {
379 8
        $this->cover = $cover;
380 8
        return $this;
381
    }
382
383
    /**
384
     * @return GoogleImage[]
385
     */
386 9
    public function getScreenshots(): array
387
    {
388 9
        return $this->screenshots;
389
    }
390
391
    /**
392
     * @param GoogleImage[] $screenshots
393
     * @return AppBuilder
394
     */
395 8
    public function setScreenshots(array $screenshots): AppBuilder
396
    {
397 8
        $this->screenshots = [];
398 8
        foreach ($screenshots as $screenshot) {
399 8
            $this->addScreenshot($screenshot);
400
        }
401 8
        return $this;
402
    }
403
404
    /**
405
     * @param GoogleImage $image
406
     * @return AppBuilder
407
     */
408 9
    public function addScreenshot(GoogleImage $image): AppBuilder
409
    {
410 9
        $this->screenshots[] = $image;
411 9
        return $this;
412
    }
413
414
    /**
415
     * @return Category|null
416
     */
417 9
    public function getCategory(): ?Category
418
    {
419 9
        return $this->category;
420
    }
421
422
    /**
423
     * @param Category|null $category
424
     * @return AppBuilder
425
     */
426 9
    public function setCategory(?Category $category): AppBuilder
427
    {
428 9
        $this->category = $category;
429 9
        return $this;
430
    }
431
432
    /**
433
     * @return string|null
434
     */
435 9
    public function getPrivacyPoliceUrl(): ?string
436
    {
437 9
        return $this->privacyPoliceUrl;
438
    }
439
440
    /**
441
     * @param string|null $privacyPoliceUrl
442
     * @return AppBuilder
443
     */
444 8
    public function setPrivacyPoliceUrl(?string $privacyPoliceUrl): AppBuilder
445
    {
446 8
        $this->privacyPoliceUrl = $privacyPoliceUrl;
447 8
        return $this;
448
    }
449
450
    /**
451
     * @return Category|null
452
     */
453 9
    public function getCategoryFamily(): ?Category
454
    {
455 9
        return $this->categoryFamily;
456
    }
457
458
    /**
459
     * @param Category|null $categoryFamily
460
     * @return AppBuilder
461
     */
462 8
    public function setCategoryFamily(?Category $categoryFamily): AppBuilder
463
    {
464 8
        $this->categoryFamily = $categoryFamily;
465 8
        return $this;
466
    }
467
468
    /**
469
     * @return Video|null
470
     */
471 9
    public function getVideo(): ?Video
472
    {
473 9
        return $this->video;
474
    }
475
476
    /**
477
     * @param Video|null $video
478
     * @return AppBuilder
479
     */
480 8
    public function setVideo(?Video $video): AppBuilder
481
    {
482 8
        $this->video = $video;
483 8
        return $this;
484
    }
485
486
    /**
487
     * @return string|null
488
     */
489 9
    public function getRecentChanges(): ?string
490
    {
491 9
        return $this->recentChanges;
492
    }
493
494
    /**
495
     * @param string|null $recentChanges
496
     * @return AppBuilder
497
     */
498 8
    public function setRecentChanges(?string $recentChanges): AppBuilder
499
    {
500 8
        $this->recentChanges = $recentChanges;
501 8
        return $this;
502
    }
503
504
    /**
505
     * @return bool
506
     */
507 9
    public function isEditorsChoice(): bool
508
    {
509 9
        return $this->editorsChoice;
510
    }
511
512
    /**
513
     * @param bool $editorsChoice
514
     * @return AppBuilder
515
     */
516 8
    public function setEditorsChoice(bool $editorsChoice): AppBuilder
517
    {
518 8
        $this->editorsChoice = $editorsChoice;
519 8
        return $this;
520
    }
521
522
    /**
523
     * @return int
524
     */
525 9
    public function getInstalls(): int
526
    {
527 9
        return $this->installs;
528
    }
529
530
    /**
531
     * @param int $installs
532
     * @return AppBuilder
533
     */
534 8
    public function setInstalls(int $installs): AppBuilder
535
    {
536 8
        $this->installs = $installs;
537 8
        return $this;
538
    }
539
540
    /**
541
     * @return int
542
     */
543 9
    public function getNumberVoters(): int
544
    {
545 9
        return $this->numberVoters;
546
    }
547
548
    /**
549
     * @param int $numberVoters
550
     * @return AppBuilder
551
     */
552 8
    public function setNumberVoters(int $numberVoters): AppBuilder
553
    {
554 8
        $this->numberVoters = $numberVoters;
555 8
        return $this;
556
    }
557
558
    /**
559
     * @return HistogramRating|null
560
     */
561 9
    public function getHistogramRating(): ?HistogramRating
562
    {
563 9
        return $this->histogramRating;
564
    }
565
566
    /**
567
     * @param HistogramRating|null $histogramRating
568
     * @return AppBuilder
569
     */
570 8
    public function setHistogramRating(?HistogramRating $histogramRating): AppBuilder
571
    {
572 8
        $this->histogramRating = $histogramRating;
573 8
        return $this;
574
    }
575
576
    /**
577
     * @return float
578
     */
579 9
    public function getPrice(): float
580
    {
581 9
        return $this->price;
582
    }
583
584
    /**
585
     * @param float $price
586
     * @return AppBuilder
587
     */
588 8
    public function setPrice(float $price): AppBuilder
589
    {
590 8
        $this->price = $price;
591 8
        return $this;
592
    }
593
594
    /**
595
     * @return string|null
596
     */
597 9
    public function getCurrency(): ?string
598
    {
599 9
        return $this->currency;
600
    }
601
602
    /**
603
     * @param string|null $currency
604
     * @return AppBuilder
605
     */
606 8
    public function setCurrency(?string $currency): AppBuilder
607
    {
608 8
        $this->currency = $currency;
609 8
        return $this;
610
    }
611
612
    /**
613
     * @return string|null
614
     */
615 9
    public function getOffersIAPCost(): ?string
616
    {
617 9
        return $this->offersIAPCost;
618
    }
619
620
    /**
621
     * @param string|null $offersIAPCost
622
     * @return AppBuilder
623
     */
624 8
    public function setOffersIAPCost(?string $offersIAPCost): AppBuilder
625
    {
626 8
        $this->offersIAPCost = $offersIAPCost;
627 8
        return $this;
628
    }
629
630
    /**
631
     * @return bool
632
     */
633 9
    public function isContainsAds(): bool
634
    {
635 9
        return $this->containsAds;
636
    }
637
638
    /**
639
     * @param bool $containsAds
640
     * @return AppBuilder
641
     */
642 8
    public function setContainsAds(bool $containsAds): AppBuilder
643
    {
644 8
        $this->containsAds = $containsAds;
645 8
        return $this;
646
    }
647
648
    /**
649
     * @return string|null
650
     */
651 9
    public function getSize(): ?string
652
    {
653 9
        return $this->size;
654
    }
655
656
    /**
657
     * @param string|null $size
658
     * @return AppBuilder
659
     */
660 8
    public function setSize(?string $size): AppBuilder
661
    {
662 8
        $this->size = $size;
663 8
        return $this;
664
    }
665
666
    /**
667
     * @return string|null
668
     */
669 9
    public function getAppVersion(): ?string
670
    {
671 9
        return $this->appVersion;
672
    }
673
674
    /**
675
     * @param string|null $appVersion
676
     * @return AppBuilder
677
     */
678 8
    public function setAppVersion(?string $appVersion): AppBuilder
679
    {
680 8
        $this->appVersion = $appVersion;
681 8
        return $this;
682
    }
683
684
    /**
685
     * @return string|null
686
     */
687 9
    public function getAndroidVersion(): ?string
688
    {
689 9
        return $this->androidVersion;
690
    }
691
692
    /**
693
     * @param string|null $androidVersion
694
     * @return AppBuilder
695
     */
696 8
    public function setAndroidVersion(?string $androidVersion): AppBuilder
697
    {
698 8
        $this->androidVersion = $androidVersion;
699 8
        return $this;
700
    }
701
702
    /**
703
     * @return string|null
704
     */
705 9
    public function getMinAndroidVersion(): ?string
706
    {
707 9
        return $this->minAndroidVersion;
708
    }
709
710
    /**
711
     * @param string|null $minAndroidVersion
712
     * @return AppBuilder
713
     */
714 8
    public function setMinAndroidVersion(?string $minAndroidVersion): AppBuilder
715
    {
716 8
        $this->minAndroidVersion = $minAndroidVersion;
717 8
        return $this;
718
    }
719
720
    /**
721
     * @return string|null
722
     */
723 9
    public function getContentRating(): ?string
724
    {
725 9
        return $this->contentRating;
726
    }
727
728
    /**
729
     * @param string|null $contentRating
730
     * @return AppBuilder
731
     */
732 8
    public function setContentRating(?string $contentRating): AppBuilder
733
    {
734 8
        $this->contentRating = $contentRating;
735 8
        return $this;
736
    }
737
738
    /**
739
     * @return \DateTimeInterface|null
740
     */
741 9
    public function getReleased(): ?\DateTimeInterface
742
    {
743 9
        return $this->released;
744
    }
745
746
    /**
747
     * @param \DateTimeInterface|null $released
748
     * @return AppBuilder
749
     */
750 8
    public function setReleased(?\DateTimeInterface $released): AppBuilder
751
    {
752 8
        $this->released = $released;
753 8
        return $this;
754
    }
755
756
    /**
757
     * @return \DateTimeInterface|null
758
     */
759 9
    public function getUpdated(): ?\DateTimeInterface
760
    {
761 9
        return $this->updated;
762
    }
763
764
    /**
765
     * @param \DateTimeInterface|null $updated
766
     * @return AppBuilder
767
     */
768 8
    public function setUpdated(?\DateTimeInterface $updated): AppBuilder
769
    {
770 8
        $this->updated = $updated;
771 8
        return $this;
772
    }
773
774
    /**
775
     * @return int
776
     */
777 9
    public function getNumberReviews(): int
778
    {
779 9
        return $this->numberReviews;
780
    }
781
782
    /**
783
     * @param int $numberReviews
784
     * @return AppBuilder
785
     */
786 8
    public function setNumberReviews(int $numberReviews): AppBuilder
787
    {
788 8
        $this->numberReviews = $numberReviews;
789 8
        return $this;
790
    }
791
792
    /**
793
     * @return Review[]
794
     */
795 9
    public function getReviews(): array
796
    {
797 9
        return $this->reviews;
798
    }
799
800
    /**
801
     * @param Review[] $reviews
802
     * @return AppBuilder
803
     */
804 8
    public function setReviews(array $reviews): AppBuilder
805
    {
806 8
        $this->reviews = [];
807 8
        foreach ($reviews as $review) {
808 8
            $this->addReview($review);
809
        }
810 8
        return $this;
811
    }
812
813
    /**
814
     * @param Review $review
815
     * @return AppBuilder
816
     */
817 8
    public function addReview(Review $review): AppBuilder
818
    {
819 8
        $this->reviews[] = $review;
820 8
        return $this;
821
    }
822
}
823